aboutsummaryrefslogtreecommitdiff
path: root/core/file_io.lua
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2009-07-07 20:49:45 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2009-07-07 20:49:45 -0400
commitae87d21236bb01b9680e8241956b9239133b0c1c (patch)
treedbc03f0a5492c9cb7d21b37fb28544c5d1435f6c /core/file_io.lua
parent7d8b623ea9c0391657a332f7270737f779187797 (diff)
downloadtextadept-ae87d21236bb01b9680e8241956b9239133b0c1c.tar.gz
textadept-ae87d21236bb01b9680e8241956b9239133b0c1c.zip
Use ~/.textadept/ for user settings, sessions, themes, lexers, etc.
Diffstat (limited to 'core/file_io.lua')
-rw-r--r--core/file_io.lua12
1 files changed, 4 insertions, 8 deletions
diff --git a/core/file_io.lua b/core/file_io.lua
index 68cb777a..4cb9210f 100644
--- a/core/file_io.lua
+++ b/core/file_io.lua
@@ -313,15 +313,13 @@ end
-- Textadept restores split views, opened buffers, cursor information, and
-- project manager details.
-- @param filename The absolute path to the session file to load. Defaults to
--- $HOME/.ta_session if not specified.
+-- $HOME/.textadept/session if not specified.
-- @param only_pm Flag indicating whether or not to load only the Project
-- Manager session settings. Defaults to false.
-- @return true if the session file was opened and read; false otherwise.
-- @usage textadept.io.load_session(filename)
function load_session(filename, only_pm)
- local user_dir = os.getenv(not WIN32 and 'HOME' or 'USERPROFILE')
- if not user_dir then return end
- local ta_session = user_dir..'/.ta_session'
+ local ta_session = _USERHOME..'/session'
local f = io.open(filename or ta_session, 'rb')
if not f then return false end
local current_view, splits = 1, { [0] = {} }
@@ -384,7 +382,7 @@ end
-- Saves split views, opened buffers, cursor information, and project manager
-- details.
-- @param filename The absolute path to the session file to save. Defaults to
--- $HOME/.ta_session if not specified.
+-- $HOME/.textadept/session if not specified.
-- @usage textadept.io.save_session(filename)
function save_session(filename)
local session = {}
@@ -445,9 +443,7 @@ function save_session(filename)
session[#session + 1] =
("pm: %d %s %s"):format(pm.width, pm.cursor or '0', pm.entry_text)
-- Write the session.
- local user_dir = os.getenv(not WIN32 and 'HOME' or 'USERPROFILE')
- if not user_dir then return end
- local ta_session = user_dir..'/.ta_session'
+ local ta_session = _USERHOME..'/session'
local f = io.open(filename or ta_session, 'wb')
if f then
f:write(table.concat(session, '\n'))