On Windows host, if the user selected the root directory as Host
Directory Sharing path, the emulator launching failure could occur.
There was a code that remove the last backslash of entered path on
Windows implementation. By the way, stat() function could not read the
path when root path like 'c:\' had entered and been removed the last
backslash(the result was 'c:').
So we change the code to remove the backslash only if the entered path
is not a root directory.
We should check the stat() working mechanism about reading pathes
including backslash on Windows later.
Change-Id: I7a155520af1f008f927e6dc67408e930c0f73ab1
Signed-off-by: ChulHo Song <ch81.song@samsung.com>
Signed-off-by: Sooyoung Ha <yoosah.ha@samsung.com>
(cherry picked from commit
20be828e348259146208ee67f13c1b340a8eaff8)
GetDiskFreeSpace(RootPathName, NULL, &BytesPerSector, NULL, NULL);
hostBytesPerSector = BytesPerSector;
}
+ /* TODO
+ * We should check how this works.
+ */
err = stat(pathname, stbuf);
/* Modify the permission to 777 except the directories. */
return g_strdup_printf("%s/%s", ctx->fs_root, path);
#else
char *buffer;
+ unsigned int len;
- buffer = g_strdup_printf("%s\\%s", ctx->fs_root, path);
- while(buffer[strlen(buffer)-1] == '\\'){
- buffer[strlen(buffer)-1] = '\0';
+ buffer = g_strdup_printf("%s\\%s", ctx->fs_root, path);
+ len = strlen(buffer);
+
+ // TODO : need to remove backslash??
+ while (len && buffer[len-1] == '\\') {
+ if (len > 1 && buffer[len-2] == ':') {
+ return buffer;
+ }
+ buffer[--len] = '\0';
}
return buffer;
#endif