rhysd / NyaoVim

Web-enhanced Extensible Neovim Frontend
Other
2.22k stars 57 forks source link

Generates default nyaovimrc at wrong path #21

Open learningjs opened 8 years ago

learningjs commented 8 years ago

NyaoVim 0.0.10 electron : 0.36.3 chrome : 47.0.2526.73 node : 5.1.1 v8 : 4.7.80.23 Arch Linux

Running NyaoVim for the first time, it logs:

Generate default nyaovimrc at /home/user/~/.config/nyaovim/nyaovimrc.html

subsequent times (always):

Generate default nyaovimrc at /home/user/~/.config/nyaovim/~/.config/nyaovim/nyaovimrc.html

I can be wrong, but I expected to be ~/.config/nyaovim/nyaovimrc.html

If I create manually ~/.config/nyaovim/nyaovimrc.html and run again NyaoVim no more initial messages are showed, but the configuration used by it is:

/home/user/~/.config/nyaovim/nyaovimrc.html
rhysd commented 8 years ago

Could you tell me output of below command?

echo $XDG_CONFIG_HOME

And if you can, could you tell me appData directory? How to try is:

  1. Open NyaoVim
  2. Open DevTools from menu item
  3. Select 'Console' tab
  4. Eval require('electron').remote.app.getPath('appData') in console
learningjs commented 8 years ago

Are you able to reproduce the behaviour?

echo $XDG_CONFIG_HOME ~/.config

require('electron').remote.app.getPath('appData') "/home/user/~/.config"

I forgot to specify that I use i3wm, if that matters.

rhysd commented 8 years ago

Are you able to reproduce the behaviour?

No, I can't reproduce this yet. I tried setting export XDG_CONFIG_HOME=~/.config, but the path to config directory was correctly ~/.config/nyaovim. This may be because I don't have Linux environment temporarily and I tried it in OS X.

Thank you for your cooperation.

"/home/user/~/.config"

This is weird... It should be "/home/user/.config", I think. Are you setting $XDG_CONFIG_HOME in your shell config file? If so, changing it as below may resolve this issue.

export $XDG_CONFIG_HOME=$HOME/.config

If changing to above config resolves this issue, I think this is a bug of Electron's getPath() API (~ is not considered).

learningjs commented 8 years ago

Thank you

export $XDG_CONFIG_HOME=$HOME/.config

solved the issue on Arch (I had it set to ~/.config). I will test more, but for what I see everything is working as expected now.

Pretty interesting... on Ubuntu looks like everything is fine from installation to launch (no weird recursive folders, creates regular folder in ~/.config, etc), but Nyaovim opens always as it does not read the config file. Further investigation coming :)

rhysd commented 8 years ago

I found the reason. Please read XDG base directory spec below.

http://standards.freedesktop.org/basedir-spec/latest/ar01s02.html

All paths set in these environment variables must be absolute.

So ~/.config is invalid for $XDG_CONFIG_HOME. You should use $HOME/.config.

rhysd commented 8 years ago

Sorry, I closed issue wrongly.

Nyaovim opens always as it does not read the config file

Hmm... you mean nyaovimrc.html is not loaded?

learningjs commented 8 years ago

you mean nyaovimrc.html is not loaded?

seems that is what happens, but I did not further investigated the issue

rhysd commented 8 years ago

OK, thanks.

Nyaovim opens always as it does not read the config file.

BTW, nvim/init.vim or nyaovimrc.html, which the 'config file' meant? (if you remember :smiley:)

learningjs commented 8 years ago

I mean looks like nyaovimrc.html is not loaded. I remember that I have changed the font size and on Arch did worked, but not on Ubuntu .

Not sure about nvim/init.vim . I guess this is loaded, but I do not have the Ubuntu box to hand right now.

And thank you for the XDG hint.