-
Notifications
You must be signed in to change notification settings - Fork 893
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
Follow the XDG Base Directory Specification #4093
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this isn't an accurate implementation.
- The XDG base directories specification does not require
XDG_DATA_HOME
to be set and it is usually not set. So this would do nothing most of the time. - I think
XDG_DATA_HOME
isn't the right place to put.yosys_history
. If you install Yosys with a prefix of~/.local
(which is a reasonable thing to do if you don't want to put it into/usr/local
for some reason), it puts the files that usually go to/usr/share
there, and history shouldn't be mixed with those. I think eitherXDG_CACHE_HOME
orXDG_CONFIG_HOME
should be used for this. (I did a quick search and on my system history files are placed in all three of data, config, and cache.) The issue you're referencing suggestsXDG_CACHE_HOME
so that's probably what should be used.
Yea, XDG_CACHE_HOME is more suitable for the history file. Is it OK to just obey the spec? Or should I create an extra env variable like other projects do: YOSYS_HISTORY_FILE. Since, users can set it to an XDG compliant location themselves. |
@nakengelhardt What do you think? To me it seems like the history file is not particularly important nor is its loss troublesome so a breaking change in the service of supporting the spec properly is fine here. |
Reading the spec, wouldn't
I don't think there's a point to having an extra variable, the people who care about where the files land can set the XDG variables (we should perhaps note that somewhere in the docs, but I'm not sure where would be a good place). The fallback is mostly for the people who don't really care and just want things to work, so I think what the spec says works fine there:
I would be happy to change the fallback location to that, the one-time loss of contents of the history file is not a big deal IMO. |
I accidentally requested review for the previous commit. I am sorry about that. It's my first time using PR on GitHub. As requested fallback location is |
Is there a Yosys way of checking if dir exists and create them? Line 345 in 6a7fad4
I can either define a new function #if defined(_WIN32) && !defined(__MINGW32__)
# include <direct.h>
# define mkdir(path, mode) _mkdir(path)
# define stat(path, buffer) _stat(path,buffer)
#endif
#if defined (__linux__) || defined(__FreeBSD__)
# include <sys/stat.h>
# include <sys/types.h>
#endif |
@hakan-demirli please note that we build mingw build as main windows build (for oss-cad-suite) and for it |
I will clean the code since there are redundancies and unnecessary includes which are also coming from yosys.h. However it functionally works for all combinations of HOME and XDG_STATE_DIR. I will also test it with mingw. However I have two questions.
|
Boost isn't a hard Yosys dependency. (There are some features that only work with Boost, but the base Yosys application can be built without Boost.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Have tested windows build and it creates directory correctly. However there is issue with log messages, they are never displayed.
maybe it should be (not sure about Windows part needed ).
|
Closes #2060