Open sichendart opened 4 years ago
Actually this change was intentional: Most of the users will not built the code from source by rather install it from a conda channel. In this case is better to save the config in a location that always exists (user home) rather than the directory from where it was lunched.
OK. In that case, shall we always save the config file in the user home directory, for example, when we save from the menu or when the software quits.
I find that xrftomo.conf gets created in the bin directory if there is one not already available in the home directory when running xrftomo gui
. Entering xrftomo init
on the other hand does create the file in the home directory. I'm not sure if this is intentional or if it can be changed to automatically save to the home path regardless of initializing first with xrftomo init
or not.
This in not the intentional behavior: there should be only one config file. In this line the config file name is hard coded. This should be changed in:
config.write(args.config, args=self.params, sections=sections)
I'm using expanduser("~")
to find the home path and write the config file there. Would something like this work? So far I haven't encountered issues with starting XRFtomo from any window or path.
from os.path import expanduser
home = expanduser("~")
config.write('{}/xrftomo.conf'.format(home), args=self.params, sections=sections)
By doing the following, the xrftomo.config was generated under /Users/sichen
(XRFtomo) Ahri-59:XRFtomo sichen$ pwd /Users/sichen/src/XRFtomo (XRFtomo) Ahri-59:XRFtomo sichen$ XRFtomo init
It makes more sense to generate it under /Users/sichen/src/XRFtomo. I also check the directory for the configure file when the software is quit. It is under /Users/sichen/src/XRFtomo.