diff --git a/nx/source/runtime/devices/fs_dev.c b/nx/source/runtime/devices/fs_dev.c index b49b9172..ae5d3478 100644 --- a/nx/source/runtime/devices/fs_dev.c +++ b/nx/source/runtime/devices/fs_dev.c @@ -1039,8 +1039,17 @@ fsdev_chdir(struct _reent *r, if(R_SUCCEEDED(rc)) { fsDirClose(&fd); - strncpy(__cwd, __fixedpath, PATH_MAX); + strncpy(__cwd, fs_path, PATH_MAX); __cwd[PATH_MAX] = '\0'; + + size_t __cwd_len = strlen(__cwd); + + if (__cwd[__cwd_len-1] != '/' && __cwd_len < PATH_MAX) + { + __cwd[__cwd_len] = '/'; + __cwd[__cwd_len+1] = '\0'; + } + fsdev_fsdevice_cwd = device->id; return 0; }