* fhandler.h (FH_ENC): New enum.
(fhandler_base::get_encoded): New function. (fhandler_base::set_encoded): Ditto. * fhandler_disk_file.cc (fhandler_disk_file::opendir): Set encoded flag in fhandler, as appropriate. (fhandler_disk_file::readdir): Unmunge filename as appropriate based on new encoding flag. * path.cc (normalize_posix_path): Don't punt on files with colons. (special_char): New function. (mount_item::fnmunge): Ditto. (fnunmunge): Ditto. (special_name): Ditto. (mount_item::build_win32): Avoid drive considerations when file is encoded. (mount_info::conv_to_win32_path): Handle encoded filenames. (mount_info::conv_to_posix_path): Ditto. (fillout_mntent): Add posix string when directory is encoded. * path.h (fnunmunge): Declare. (path_conv::is_encoded): Declare.
This commit is contained in:
@@ -607,6 +607,8 @@ fhandler_disk_file::opendir (path_conv& real_name)
|
||||
|
||||
res = dir;
|
||||
}
|
||||
if (real_name.isencoded ())
|
||||
set_encoded ();
|
||||
}
|
||||
|
||||
syscall_printf ("%p = opendir (%s)", res, get_name ());
|
||||
@@ -633,9 +635,7 @@ fhandler_disk_file::readdir (DIR *dir)
|
||||
}
|
||||
}
|
||||
else if (dir->__d_u.__d_data.__handle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
return res;
|
||||
}
|
||||
return res;
|
||||
else if (!FindNextFileA (dir->__d_u.__d_data.__handle, &buf))
|
||||
{
|
||||
DWORD lasterr = GetLastError ();
|
||||
@@ -650,7 +650,10 @@ fhandler_disk_file::readdir (DIR *dir)
|
||||
}
|
||||
|
||||
/* We get here if `buf' contains valid data. */
|
||||
strcpy (dir->__d_dirent->d_name, buf.cFileName);
|
||||
if (get_encoded ())
|
||||
(void) fnunmunge (dir->__d_dirent->d_name, buf.cFileName);
|
||||
else
|
||||
strcpy (dir->__d_dirent->d_name, buf.cFileName);
|
||||
|
||||
/* Check for Windows shortcut. If it's a Cygwin or U/WIN
|
||||
symlink, drop the .lnk suffix. */
|
||||
|
Reference in New Issue
Block a user