adjust fsdev_fixpath for cwd changes (#132)

* adjust fsdev_fixpath for cwd changes
This commit is contained in:
Dave Murphy 2018-07-19 16:31:51 +01:00 committed by yellows8
parent d48cf6aa2e
commit aa3c35e6e3

View File

@ -1039,8 +1039,17 @@ 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] = '/';
__cwd[__cwd_len+1] = '\0';
}
fsdev_fsdevice_cwd = device->id; fsdev_fsdevice_cwd = device->id;
return 0; return 0;
} }