Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lite Only Opens In Its Directory #76

Closed
amrojjeh opened this issue Mar 4, 2021 · 9 comments
Closed

Lite Only Opens In Its Directory #76

amrojjeh opened this issue Mar 4, 2021 · 9 comments

Comments

@amrojjeh
Copy link

amrojjeh commented Mar 4, 2021

A bit difficult to describe it well in the title, but essentially I'm not able to open Lite from the command prompt outside of where the data directory exists. When I installed the source, even though it contained a different data folder, I was indeed able to open Lite, even though it didn't use the data folder which came with the source. Anywhere else, however, the program would simply not launch. No errors would be displayed, no warnings, no logfile from as far as I can tell. From as far as I can tell, this is due to core.init, but I've not been able to fix the problem as of now. Any suggestions?

Operating System: Windows

@amrojjeh
Copy link
Author

amrojjeh commented Mar 5, 2021

Update: After some more testing, it's clear that it's from the initial lua string in the main.c file. Here's the standard output:

Error: cannot open data/core/start.lua: No such file or directory
stack traceback:
        [C]: in function 'dofile'
        [string "local core..."]:5: in function <[string "local core..."]:2>
        [C]: in function 'xpcall'
        [string "local core..."]:2: in main chunk

I tried modifying the string, however, the program seems to silently crash whenever I change it. Any reason why?

@franko
Copy link
Member

franko commented Mar 5, 2021

Hi, thank you for your investigations. Thank to your message I understood the problem. The following change is needed in src/main.c:

     "  HOME = os.getenv('HOME')\n"
 #endif
     "  local prefix = EXEFILE:match(\"^(.+)[/\\\\]bin[/\\\\][^/\\\\]+$\")\n"
-    "  dofile((prefix and prefix .. '/share/lite-xl' or 'data') .. '/core/start.lua')\n"
+    "  local exedir = EXEFILE:match(\"^(.+)[/\\\\][^/\\\\]+$\")\n"
+    "  dofile((prefix and prefix .. '/share/lite-xl' or exedir .. '/data') .. '/core/start.lua')\n"
     "  core = require('core')\n"
     "  core.init()\n"
     "  core.run()\n"

but, since a .c file is modified a re-compilation is needed.

I going to include the fix and publish a new hotfix release today I home.

@franko franko closed this as completed in 1ea497d Mar 5, 2021
@amrojjeh
Copy link
Author

amrojjeh commented Mar 5, 2021

Huh, that's interesting. I updated the main.c and compiled it myself, however, the program doesn't seem to be launching anymore.

D:\Projects\lite-xl\build\src>.\lite

D:\Projects\lite-xl\build\src>.\lite > output.txt

D:\Projects\lite-xl\build\src>type output.txt

D:\Projects\lite-xl\build\src>

I was able to compile and run before the change. I was also able to do that when adding print statements in the C string, yet whenever I modified the regex or added the local exedir, the program seems to simply not open anymore, even though it compiles. I'm interested in whether you'll encounter similar problems or not. It could be because I'm on Windows and I updated the build system so that it uses the sdl wrap rather than the linux package. I'm a bit busy now so I can't dig into it now sadly, but I'll be looking forward to the next release. Thanks!

Edit: Other than adding the SDL wrap, I also added community written header files to replace the ones exclusive to Linux, such as dirent.h and unistd.h

@franko
Copy link
Member

franko commented Mar 5, 2021

Please check again the master branch. I have fixed some stuff and tested extensively on Windows. I am preparing a release.

@franko franko reopened this Mar 5, 2021
@franko
Copy link
Member

franko commented Mar 5, 2021

Should work now with the new release. Waiting to have some feedback before closing the issue.

@franko
Copy link
Member

franko commented Mar 7, 2021

I am pretty much positive that this bug was already solver with 1.16.2 and 1.16.3 is already out.

@franko franko closed this as completed Mar 7, 2021
@amrojjeh
Copy link
Author

amrojjeh commented Mar 7, 2021

Oh, I apologize. I should've totally tested it, but I was busy at the time and I forgot to go back to the email. I just downloaded the latest version, and when running it now, I get this error message written in error.txt, regardless of the current directory:

Error: error loading module 'core.command' from file 'C:\Program Files\lite/data/core\command.lua':
	C:\Program Files\lite/data/core\command.lua:28: too many C levels (limit is 200) in function at line 27 near '1'
stack traceback:
	[C]: in ?
	[C]: in function 'require'
	C:\Program Files\lite/data/core\command.lua:2: in main chunk
	[C]: in function 'require'
	C:\Program Files\lite/data/core\command.lua:2: in main chunk
	[C]: in function 'require'
	C:\Program Files\lite/data/core\command.lua:2: in main chunk
	...
	[C]: in function 'require'
	C:\Program Files\lite/data/core\command.lua:2: in main chunk
	[C]: in function 'require'
	C:\Program Files\lite/data/core\command.lua:2: in main chunk
	[C]: in function 'require'
	C:\Program Files\lite/data/core\command.lua:2: in main chunk
	[C]: in function 'require'
	C:\Program Files\lite/data/core/init.lua:348: in function 'init'
	[string "local core..."]:8: in function <[string "local core..."]:2>
	[C]: in function 'xpcall'
	[string "local core..."]:2: in main chunk

I'd look into it further but that's all the time I have for now. Thank you for helping out. I really appreciate it!

Edit: Latest verison = 1.16.3

@franko
Copy link
Member

franko commented Mar 8, 2021

Thank you for testing and for reporting this problem.

Actually the error you see is unrelated to the problem you reported in this issue. Looking at the stack traceback it doesn't make a lot of sense to me unless you modified some of the lua files bundled with lite-xl.

I would suggest making a new test by deleting any previous install of lite-xl and remove any plugin you may have in:

%USERPROFILE%/.config/lite-xl/plugins

@amrojjeh
Copy link
Author

amrojjeh commented Mar 8, 2021

Oh, you're absolutely on the mark on that one. I updated Lite by replacing the files, but I suppose that left some of the old files untouched and that could've messed with the application. Thank you for your help! I can't make promises but I'll certainly try to fit the time to make contributions back, you totally deserve any support you can get.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants