Avoid using "." for the current directory.#959
Avoid using "." for the current directory.#959isojalka wants to merge 1 commit intoTheAssemblyArmada:vanillafrom
Conversation
OmniBlade
left a comment
There was a problem hiding this comment.
Seems reasonable to me.
All supported platforms support leaving out "./" (or ".\") in front of paths to indicate the current directory. However, not all platforms support using "." to indicate the current directory. Modified the code to avoid constructing paths with "./" or ".\" when no directory component needs to be prepended to a path.
05ee406 to
30f0345
Compare
|
That will result in empty paths to be passed to opendir instead of "." when the search path (ie. as returned from Program_Path()) is also empty. Since that is MorphOS specific, it should be protected by an ifdef. |
|
It is not MorphOS-specific, and getting rid of ifdefs is one of the things I'm trying to do and have been doing a lot. If something needs platform-specific handling, it should go into a platform-specific file. But this particular problem could also be solved in a different way that'd avoid ending up with a completely empty path. Instead of the current change, PathsClass::Concatenate_Paths() could be modified to handle one or more empty components, and if two empty components are passed to it, it could then return "." instead. Would such a solution work for you? |
|
I i understand it correctly, then the problem is that MorphOS does not handle opendir(".") (see https://github.com/isojalka/Vanilla-Conquer/blob/aa0fd65572e526dbaaff614d787372d1db229767/common/file_morphos.cpp#L97) But on other os, opendir("") will fail, and that will happen with the above patch.
I have to check, but that might work. See also #950 where that is already partly implemented. |
All supported platforms support leaving out "./" (or ".") in front of paths to indicate the current directory. However, not all platforms support using "." to indicate the current directory.
Modified the code to avoid constructing paths with "./" or "." when no directory component needs to be prepended to a path.