diff options
author | 2009-06-16 17:22:48 -0400 | |
---|---|---|
committer | 2009-06-16 17:22:48 -0400 | |
commit | fb758ea341c45b4358f53fe1c945d235de08703c (patch) | |
tree | 81b87475ad0aec2e725f98d5c28f6d2136840135 | |
parent | b2d6e2b80e7b0a14bbb0d29a3614f5450af52b95 (diff) |
Check for ~/.ta_modules using io.open instead of dofile error message; init.lua
-rw-r--r-- | init.lua | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -8,9 +8,14 @@ package.path = mpath..';'..package.path local loaded_user_modules = false local user_dir = os.getenv(not WIN32 and 'HOME' or 'USERPROFILE') if user_dir then - local ret, errmsg = pcall(dofile, user_dir..'/.ta_modules') - if not ret and not errmsg:find('No such file') then error(errmsg) end - loaded_user_modules = ret + local ta_modules = user_dir..'/.ta_modules' + local f = io.open(ta_modules) + if f then + f:close() + local ret, errmsg = pcall(dofile, ta_modules) + if not ret then error(errmsg) end + loaded_user_modules = ret + end end if not loaded_user_modules then |