case_sensitive_path


Description:

[ Version ( since = "1.0.75" ) ]
public string case_sensitive_path (string path) throws Error

return true path on case-insensitive filesystem

This can be used to resolve case insensitive paths on a filesystem which is case sensitive. The use case is to resolve paths which you have read from Windows configuration files or the Windows Registry, to the true path.

The command handles a peculiarity of the Linux ntfs-3g filesystem driver (and probably others), which is that although the underlying filesystem is case-insensitive, the driver exports the filesystem to Linux as case-sensitive.

One consequence of this is that special directories such as C:\windows may appear as /WINDOWS or /windows (or other things) depending on the precise details of how they were created. In Windows itself this would not be a problem.

Bug or feature? You decide: <ulink url='http://www.tuxera.com/community/ntfs-3g-faq/posixfilenames1'> http://www.tuxera.com/community/ntfs-3g-faq/posixfilenames1 </ulink>

case_sensitive_path attempts to resolve the true case of each element in the path. It will return a resolved path if either the full path or its parent directory exists. If the parent directory exists but the full path does not, the case of the parent directory will be correctly resolved, and the remainder appended unmodified. For example, if the file "/Windows/System32/netkvm.sys" exists:

case_sensitive_path ("/windows/system32/netkvm.sys") "Windows/System32/netkvm.sys"

case_sensitive_path ("/windows/system32/NoSuchFile") "Windows/System32/NoSuchFile"

case_sensitive_path ("/windows/system33/netkvm.sys") *ERROR*

*Note*: Because of the above behaviour, case_sensitive_path cannot be used to check for the existence of a file.

*Note*: This function does not handle drive names, backslashes etc.

See also realpath.

Parameters:

this

A GuestfsSession object

Returns:

the returned string, or NULL on error