aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2011-09-26 19:40:56 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2011-09-26 19:40:56 -0400
commit914da964175fad16339a1be68bd0a4bde13abaf0 (patch)
treee065efbd69d26f4e6f76fa209f031028ffa99c64
parent8bcdb16e18641e1cea08ebb614d70d98a3c27426 (diff)
downloadtextadept-914da964175fad16339a1be68bd0a4bde13abaf0.tar.gz
textadept-914da964175fad16339a1be68bd0a4bde13abaf0.zip
Change directory on io.open_file() or buffer:save_as(); core/file_io.lua
-rw-r--r--core/file_io.lua2
1 files changed, 2 insertions, 0 deletions
diff --git a/core/file_io.lua b/core/file_io.lua
index de0e793e..bb5f452e 100644
--- a/core/file_io.lua
+++ b/core/file_io.lua
@@ -162,6 +162,7 @@ function open_file(utf8_filenames)
if file == utf8_filename then table.remove(recent_files, i) break end
end
table.insert(recent_files, 1, utf8_filename)
+ lfs.chdir(utf8_filename:iconv('UTF-8', _CHARSET):match('.+[/\\]'))
end
end
@@ -241,6 +242,7 @@ local function save_as(buffer, utf8_filename)
buffer.filename = utf8_filename
buffer:save()
events.emit(events.FILE_SAVED_AS, utf8_filename)
+ lfs.chdir(utf8_filename:iconv('UTF-8', _CHARSET):match('.+[/\\]'))
end
end