-
Notifications
You must be signed in to change notification settings - Fork 121
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
new xsos v1 branch: split all modules into separate files #159
base: master
Are you sure you want to change the base?
Conversation
Check it out @lathan |
So much stuff! |
I have a question about # XSOS_ASSET_PATH (directory path)
# xsos was split into multiple files starting with xsos v1
# This directory must contain all of xsos' helper modules
: ${XSOS_ASSET_PATH:="/usr/share/xsos"} Is this going to be a strict requirement? |
Yeah it's tempting isn't it? Something like:
This works if you call xsos from that directory directly, e.g.:
But as soon as you move the executable to some bindir in your path (or create a symlink to it where it is, for that matter), things break.
You may know this, but another cool thing about all those config variables is that you can override them in your shell environment without modifying xsos. If using bash, you can permanently change any setting by putting it (as an exported environment variable) in one of your config files like
|
See latest comment for summary of ramblings. I was thinking of something "smarter". For example, checking first the "current" directory, then checking Of course, when programs try to be smart, they sometimes end up being very stupid. So I was trying to think if there is any other program that I'm aware of that works similarly. The only thing that comes to mind is how things like bash check for config files, but configs != modules. The main thing that bugs me here is that I feel like it should be possible to just run xsos from the git repo, with no extra steps, or parameters, or env variables. So if this feeling is a good feeling, I'm assuming that some other project has already solved a similar problem. But maybe this is a bad feeling and the proper way is to just define a default path. |
More ramblings incoming! See latest comment for summary of ramblings. So another thing comes to mind. Python modules! How does python decide in which paths to look for modules when you do for example Basically, the python interpreter looks at three places and uses the first match. The first place it looks is "the directory containing the input script (or the current directory)." Then I remembered, I've actually used this - writing python modules and importing them in a script in the same directory. So at this point I think my feels are good feels. |
To summarize my ramblings: My suggestion is to make xsos look in multiple locations for the modules with the current directory taking precedence - essentially something similar to how python looks for modules. More specifically, this could be handled by the |
@lathan DONE. Here's what I set it to by default:
Demonstration:
|
PS @lathan I had " |
👍 🎉 🎉 |
Hey @ryran I was just wondering what the status of this is. I want to work on some other issues but it looks like any work being done on master branch now will need to be manually imported here. Any advice? |
As it says on the tin ... with xsos v1, we'll be trading the single-file convenience for a path to less code complexity -- easier to find things, do maintenance; easier to add new features, etc. This branch does not add any new features (except potentially sliiightly less memory usage & load time when not using all modules).
The next step will be to rewrite the core in python and then slowly start migrating the modules to python as well, with the option for them to be in any language.