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

Relative paths for dictionary directories [node] #38

Open
JuanCaicedo opened this issue Apr 5, 2016 · 4 comments
Open

Relative paths for dictionary directories [node] #38

JuanCaicedo opened this issue Apr 5, 2016 · 4 comments

Comments

@JuanCaicedo
Copy link

I found that if I try to give Typo a relative path to my dictionaries in node, it throws an error like

Path ../../dictionaries/en_US/en_US.dic does not exist.

I think that's happening because of this check, which will be relative to node_module/typo-js/typo.js

if (fs.existsSync(path)) {

I think it can be fixed by something like, which works for me locally.

var _path = require('path')
...
path = _path.join(__dirname, path);
if (fs.existsSync(path)) {

I can make a PR to update this

@JuanCaicedo
Copy link
Author

Actually, it might be better to just document that the user should provide an absolute path to Typo, which they can get using the path.join. I think that's more robust in the long run

@cfinke
Copy link
Owner

cfinke commented Apr 8, 2016

Agreed on just documenting the path argument as an absolute path.

@mstamatiadou
Copy link

Hi,

I am trying to use the library and I 'm still getting Error: ENOENT, no such file or directory for the dictionaries path. Giving the absolute path still doesn't work for me. I also saw in your code that fs.existsSync(path) (line 167) is deprecated and I changed it to fs.statSync(path) but it did not work either.

Could you please suggest something?

@JuanCaicedo
Copy link
Author

@Stoup I think it would be best for you to open up a stackoverflow question and post some more details about your code, otherwise it's difficult to help

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

3 participants