Jump to content

Recommended Posts

Posted

Hello,

I am using a function to retrieve the filepath case correct. This is working without problems, if the path is located in my @HomeDrive.

If the path is on another drive, it fails. My _PathCaseSensitive function is using FileGetShortName and this seems to be the culprit.

#Region Main
    _Check("C:\_A ab\_SomeNameForSomeFolder") ; works for me
    _Check("D:\_B bb\_SomeNameForSomeFolder")
    _Check("Y:\_B bb\_SomeNameForSomeFolder")
#EndRegion Main

#Region Functions
    Func _Check($p_sgPath)
        ; Create
        DirCreate($p_sgPath)

        ; Short name
        Local $l_sgPath = FileGetShortName($p_sgPath)
        ConsoleWrite("ToCreate: " & $p_sgPath & @CRLF)
        ConsoleWrite("Lower:    " & $l_sgPath & @CRLF)
        ConsoleWrite("Exists:   " & FileExists($l_sgPath) & @CRLF)
        ConsoleWrite("Correct:  " & String($p_sgPath <> $l_sgPath) & @CRLF)
        ConsoleWrite(@CRLF)
    EndFunc   ;==>_Check
#EndRegion Functions

Both, D:\ and Y:\ are partition of the same HDD than C:\.

 

Just for more context, this is the function I use retrieve the filepath case correct:

#Region Function
    Func _PathCaseSensitive($p_sgPath)
        If Not FileExists($p_sgPath) Then Return SetError(0x01, 0, $p_sgPath)
        
        ; Get shortname, convert lower case and then get long name
        $p_sgPath = FileGetLongName(StringLower(FileGetShortName($p_sgPath)))

        ; Replace drive letter with uppercase version
        $p_sgPath = Execute('"' & StringRegExpReplace($p_sgPath, "^(\w):", '" & StringUpper("$1:") & "') & '"')
        Return $p_sgPath
    EndFunc   ;==>_PathCaseSensitive
#EndRegion Functions

 

Posted

@HurleyShanabarger

check Properties of _B bb folderAnd _B bb Folder that located at:

_Check("D:\_B bb\_SomeNameForSomeFolder")
    _Check("Y:\_B bb\_SomeNameForSomeFolder

By Going into -> D:\_B bb folder or Y:\_B bb folder -> Right Click on Folder _B bb -> Security Tab -> Make sure that Allow Read & Full Control.

none

Posted

Thanks for the hint, but that was not it.

Using fsutil, I see that the 8.3 name creation is disabled on the other drives:

fsutil 8dot3name query Y:
The volume state is: 1 (8dot3 name creation is disabled).
The registry state is: 2 (Per volume setting - the default).

Based on the above settings, 8dot3 name creation is disabled on Y:

Maybe this is worth mentioning in the helpfile?

Now I am back to square one: How can I convert any given path into the case correct form?
 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...