ModOrganizer2 / mob

Mod Organizer Builder.
15 stars 22 forks source link

Lookup mob.ini in parent folders and make prefix relative to .ini containing it #48

Closed Holt59 closed 4 years ago

Holt59 commented 4 years ago

Since there is no easy way of checking if a .ini contains a paths/prefix entry in find_inis, I simply stop at the first .ini found, which should be enough.

The init_options is a bit more messy since I need to remember which .ini contained the paths/prefix. Maybe I could assume the last one in the list? But I still would have to check if the prefix is given in the command line.

isanae commented 4 years ago

I'm not sure I like blindly going up directories until an ini is found. I was doing something similar before to allow running from build/Debug/x64 and still find mob.ini in the project root, but I've changed it to really make sure it's the build directory by checking for Debug and Release.

On the other hand, I could consider that any mob.ini I find in a parent directory is the root of a mob project. In fact, after a mob -d prefix build, I could drop an empty mob.ini in prefix as an anchor. Thinking out loud while having coffee.

Holt59 commented 4 years ago

I thought about checking for more stuffs, e.g., build, downloads, etc., but creating a mob.ini with a paths/prefix=. after (or before) a mob build might be a good idea.

Holt59 commented 4 years ago

Updated to drop a mob.ini with only

[paths]
prefix = .

in the build directory if not present. I had to create the build directory there as it does not seem to be created yet.

isanae commented 4 years ago

Holt, this has been sitting in my inbox for months, how useful is it?

Holt59 commented 4 years ago

For me it's pretty useful, which is why I rebase it to follow master every time. I run mob from anywhere under the build tree without thinking where I am.

One minor issue with the current version is that it creates mob.log in the current directory, hence I have mob.log about everywhere...

isanae commented 4 years ago

What if I change the generated ini to use an absolute path for log_file set to prefix()/mob.log?

Holt59 commented 4 years ago

Yes, would be nice.

Or maybe make log_file be relative to the prefix instead of the current folder?

isanae commented 4 years ago

Will do.