mirror of
https://github.com/switchbrew/libnx.git
synced 2025-07-05 19:02:14 +02:00
move cwd fix to chdir
This commit is contained in:
parent
b748f14bc9
commit
c1e0ea9a6c
@ -199,13 +199,6 @@ fsdev_fixpath(struct _reent *r,
|
|||||||
strncpy(__fixedpath, path, PATH_MAX);
|
strncpy(__fixedpath, path, PATH_MAX);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
size_t __cwd_len = strlen(__cwd);
|
|
||||||
|
|
||||||
if (__cwd[__cwd_len-1] != '/' && __cwd_len < PATH_MAX)
|
|
||||||
{
|
|
||||||
__cwd[__cwd_len] = '/';
|
|
||||||
}
|
|
||||||
|
|
||||||
strncpy(__fixedpath, __cwd, PATH_MAX);
|
strncpy(__fixedpath, __cwd, PATH_MAX);
|
||||||
__fixedpath[PATH_MAX] = '\0';
|
__fixedpath[PATH_MAX] = '\0';
|
||||||
strncat(__fixedpath, path, PATH_MAX - strlen(__cwd));
|
strncat(__fixedpath, path, PATH_MAX - strlen(__cwd));
|
||||||
@ -1046,8 +1039,16 @@ fsdev_chdir(struct _reent *r,
|
|||||||
if(R_SUCCEEDED(rc))
|
if(R_SUCCEEDED(rc))
|
||||||
{
|
{
|
||||||
fsDirClose(&fd);
|
fsDirClose(&fd);
|
||||||
strncpy(__cwd, __fixedpath, PATH_MAX);
|
strncpy(__cwd, fs_path, PATH_MAX);
|
||||||
__cwd[PATH_MAX] = '\0';
|
__cwd[PATH_MAX] = '\0';
|
||||||
|
|
||||||
|
size_t __cwd_len = strlen(__cwd);
|
||||||
|
|
||||||
|
if (__cwd[__cwd_len-1] != '/' && __cwd_len < PATH_MAX)
|
||||||
|
{
|
||||||
|
__cwd[__cwd_len] = '/';
|
||||||
|
}
|
||||||
|
|
||||||
fsdev_fsdevice_cwd = device->id;
|
fsdev_fsdevice_cwd = device->id;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user