kyoheiu / felix

tui file manager with vim-like key mapping
https://kyoheiu.dev/felix/
MIT License
729 stars 26 forks source link

Does not create *any* files or folders #161

Closed theAkito closed 1 year ago

theAkito commented 1 year ago

Does not work at all, no matter what I try, unless I manually create the files & directories, this program should automatically create.

cargo install felix
# Installation Success
fx
Config file not found: To set up, please enter the default command name to open a file. (e.g. nvim)
If you want to use the default $EDITOR, just press Enter.
No such file or directory (os error 2)

fx
Config file not found: To set up, please enter the default command name to open a file. (e.g. nvim)
If you want to use the default $EDITOR, just press Enter.
/bin/nano
No such file or directory (os error 2)

export EDITOR=/bin/nano
export XDG_CONFIG_HOME=~/.config
export XDG_DATA_HOME=/tmp

fx
Config file not found: To set up, please enter the default command name to open a file. (e.g. nvim)
If you want to use the default $EDITOR, just press Enter.
No such file or directory (os error 2)

fx
Config file not found: To set up, please enter the default command name to open a file. (e.g. nvim)
If you want to use the default $EDITOR, just press Enter.
/bin/nano
No such file or directory (os error 2)

fx -l ./fx.log
Invalid path or argument: ./fx.log
`fx -h` shows help.

fx --log ./fx.log
Invalid path or argument: ./fx.log
`fx -h` shows help.

fx -l fx.log
Invalid path or argument: fx.log
`fx -h` shows help.

fx --log fx.log
Invalid path or argument: fx.log
`fx -h` shows help.

Workaround

touch fx.log # Optional, for temporary log file.
mkdir $XDG_CONFIG_HOME/felix
touch $XDG_CONFIG_HOME/felix/config.yaml
mkdir $XDG_DATA_HOME/felix
touch $XDG_DATA_HOME/felix/log

This is not a permission issue or anything like that. It just won't create anything. It just expects already existing files & directories.

Platform Debian GNU/Linux 11 (bullseye) in WSL2 on Windows 10

Terminal software Windows Terminal

kyoheiu commented 1 year ago

Thank you for the report. I don't know much about WSL, but this may be due to missing XDG_DATA_HOME and XDG_CONFIG_HOME, so I added create_dir_all for both path. Created PR #162 to fix this. Could you check by the following?

cargo install --git https://github.com/kyoheiu/felix.git --branch fix-missing-path

Also, fx takes a directory path as an argument, so if fx.log is a file, fx fx.log does not work.

theAkito commented 1 year ago

this may be due to missing XDG_DATA_HOME and XDG_CONFIG_HOME, so I added create_dir_all for both path.

Even when I did the following?

export EDITOR=/bin/nano
export XDG_CONFIG_HOME=~/.config
export XDG_DATA_HOME=/tmp

fx takes a directory path as an argument, so if fx.log is a file, fx fx.log does not work.

fx -l ./fx.log
Invalid path or argument: ./fx.log
`fx -h` shows help.

fx --log ./fx.log
Invalid path or argument: ./fx.log
`fx -h` shows help.

fx -l fx.log
Invalid path or argument: fx.log
`fx -h` shows help.

fx --log fx.log
Invalid path or argument: fx.log
`fx -h` shows help.

Why does a log file have to be a directory?

kyoheiu commented 1 year ago

After export, did you re-launch the shell? like exec bash

theAkito commented 1 year ago

After export, did you re-launch the shell? like exec bash

Of course not, else I would need to re-export. 😄

Could you please read the issue?

https://github.com/kyoheiu/felix/issues/161#issue-1501759915

Everything you need to know is posted there.

For example, this part.

fx
Config file not found: To set up, please enter the default command name to open a file. (e.g. nvim)
If you want to use the default $EDITOR, just press Enter.
/bin/nano
No such file or directory (os error 2)

So, the editor should be found a 100%. Not sure though, if the error was related to this, or the directories. Perhaps the directories. The error message must be improved, too.

theAkito commented 1 year ago

Could you check by the following?

Seems to fix it. The directory is now created. I double checked by deleting the configuration directory twice & re-generating it by launching fx.

kyoheiu commented 1 year ago

Yeah, that error message must be related the missing config directory or data local directory, so it should be separeted from the message above. In your case, /bin/nano must be set as a default command, but felix may be not able to detect the config file path or data local path where the trash bin and session file are stored. About the env, I'll take a look around dirs implementation. How is the fix PR? Could you install from that branch and test it? Good.

Log files in felix are generated in $XDG_DATA_HOME/felix/log: e.g. Application Support/felix/log/2022-12-18-16-23-22.log (This is the case of macOS).

theAkito commented 1 year ago

Log files in felix are generated in $XDG_DATA_HOME/felix/log

But, when using --log it is a file, correct? At least, that's what the documentation suggests.

It did not create the log file. I had to touch it manually, first.

Then, it still did not help me debug the issue, because nothing was written into the log, no matter what I tried. I had to figure creating the directories manually, by simply guessing & the use of my experience.

kyoheiu commented 1 year ago

The path after -l or --log should be an directory path that this app open the first, same as fx {path}. Yeah, it's not intuitive and should be updated.

theAkito commented 1 year ago

The path after -l or --log should be an directory path that this app open the first, same as fx {path}.

Then that's a bug, too, because the program did not throw any error, saying that the path provided should be a directory. Before opening this ad-hoc log location, the program should check, whether it is a directory. If not, it should tell the user to provide a directory path.

kyoheiu commented 1 year ago

Released the fixed version and update documentation. Thank you!