Skip to content
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

path_mkdir not working on wii u with trailing slash #161

Open
barbudreadmon opened this issue Jun 17, 2020 · 9 comments
Open

path_mkdir not working on wii u with trailing slash #161

barbudreadmon opened this issue Jun 17, 2020 · 9 comments

Comments

@barbudreadmon
Copy link
Contributor

barbudreadmon commented Jun 17, 2020

While there is this workaround :

#if defined(GEKKO)
{
size_t len = strlen(basedir);
/* path_parent_dir() keeps the trailing slash.
* On Wii, mkdir() fails if the path has a
* trailing slash...
* We must therefore remove it. */
if (len > 0)
if (basedir[len - 1] == '/')
basedir[len - 1] = '\0';
}
#endif

It still doesn't seem path_mkdir works properly on wii u when there is a trailing slash (the workaround makes sense so i'm not sure what's the issue and i don't have the means to debug this myself, all i can do is to try fixing this by removing the trailing slash in libretro/FBNeo@5b472aa then libretro/FBNeo@eeaabd1)

@mahoneyt944
Copy link

mahoneyt944 commented Sep 24, 2020

@barbudreadmon , just fixed this issue in mame2003-plus.

The problem is if you send path_mkdir() a path to create containing a trailing slash, this path gets copied to basedir and then the slash is removed from basedir if it's defined as a gekko based system. It then checks if basedir is a valid path or not to create. If it's valid, it enables the non recursive function that actually makes the new directory by using the original path, dir, which still contains the trailing slash. So it fails on wiiu because it can't make path dir containing the trailing slash.

They corrected the path it checks (basedir), but then it tries to make the bad path(dir). You need to also remove the trailing slash from dir then make sure your core isn't sending any file paths to path_mkdir with trailing slashes.

We also force create our system and save directories anytime osd_get_path() in src/fileio.c is called if they are not already created by default.

@barbudreadmon
Copy link
Contributor Author

make sure your core isn't sending any file paths to path_mkdir with trailing slashes.

Yes, that's exactly what i did when fixing this issue in FBNeo a few months ago

@mahoneyt944
Copy link

Yes, that's exactly what i did when fixing this issue in FBNeo a few months ago

Ok cool. Didn't know where you guys were with this issue. Just figured I'd share what we did in case it was still an open issue.

This ideally needs to be corrected in path_mkdir() by removing any trailing slashes in dir as well under the if defined gekko section.

@mahoneyt944
Copy link

mahoneyt944 commented Sep 24, 2020

@barbudreadmon I just fixed path_mkdir() for gekko systems in #172. If it gets merged. Not sure if this will effect your fix in fbneo or not.

@barbudreadmon
Copy link
Contributor Author

ok, thanks for the heads-up

@mahoneyt944
Copy link

@barbudreadmon #172 should fix these create issues if you want to test it with your core and wiiu.

@barbudreadmon
Copy link
Contributor Author

barbudreadmon commented Sep 30, 2020

hmmm, how come you are freeing len & len2 ? They aren't ptr (http://www.cplusplus.com/reference/cstdlib/free/).

@mahoneyt944
Copy link

mahoneyt944 commented Sep 30, 2020

@barbudreadmon whoops. I meant to free newdir, fixed it now. Please test the updated fix. I don't have a wiiu but I believe this should fix it from the libretro side. If so you'll have to check your slash situation in fbneo

@barbudreadmon
Copy link
Contributor Author

barbudreadmon commented Sep 30, 2020

I've no real means for testing this either :/. No wiiu sdk and no emulator able to run RA wiiu homebrew available on linux anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants