Modify ↓
Opened 10 years ago
Closed 10 years ago
#2825 closed Bug (No Bug)
Dir Functions inconsistent behaviour with VolumeName as source
Reported by: | ResNullius | Owned by: | |
---|---|---|---|
Milestone: | Component: | AutoIt | |
Version: | 3.3.12.0 | Severity: | None |
Keywords: | Cc: |
Description
AutoIt Release 3.3.12.0 & latest Beta 3.3.13.15
Tested on both Win 7 x64 and x86 systems
When using a Volume Name (
?\Volume{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}\) as the source for Dir operations, the DirCopy, DirMove, & DirRemove functions fail. DirCreate and DirGetSize work as expected as do FileCopy and FileMove functions, although FileFindNextFile fails.
I would expect some consistency; either all operations fail, Dir & File, or all succeed.
$sVolumeName = _GetVolumeNameForVolumeMountPoint("C:\") ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $sVolumeName = ' & $sVolumeName & @CRLF) ;### Debug Console $sVolumeNameTestDir = $sVolumeName & "~testDir~" $sTestFile = $sVolumeNameTestDir & "\~File1.txt~" $iCreate = DirCreate($sVolumeNameTestDir) ;this works to create a folder on VolumeName destination ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $iCreate = ' & $iCreate & @CRLF) ;### Debug Console $iFileCreate = FileClose(FileOpen($sTestFile, 2)) ;this works, creating a file in VolumeName Destination ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $iFileCreate = ' & $iFileCreate & @CRLF) ;### Debug Console $iWrite = FileWriteLine($sTestFile, "line one") ;this works, writing to a file in VolumeName destination ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $iWrite = ' & $iWrite & @CRLF) ;### Debug Console $iFileCopy = FileCopy($sTestFile, $sVolumeNameTestDir& "\~file2.txt~") ; this works, copy a file using VolumeName as source and destination ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $iFileCopy = ' & $iFileCopy & @CRLF) ;### Debug Console $iFileCopy2 = FileCopy($sTestFile, @TEMPDIR, 1) ;this works copying a file from VolumeName source ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $iFileCopy2 = ' & $iFileCopy2 & @CRLF) ;### Debug Console $iSize = DirGetSize($sVolumeNameTestDir) ;this works, getting size of folder in VolumeName source ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $iSize = ' & $iSize & @CRLF) ;### Debug Console $iDirCopy = DirCopy($sVolumeNameTestDir, @TEMPDIR, 1) ;this fails, copying a folder from VolumeName source ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $iDirCopy = ' & $iDirCopy & @CRLF) ;### Debug Console $iMove = DirMove($sVolumeNameTestDir, @TEMPDIR & "\~TESTDIR_MOVED", 1) ;this fails, but does create an empty target dir ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $iMove = ' & $iMove & @CRLF) ;### Debug Console $iRemove = DirRemove($sVolumeNameTestDir, 1) ;this fails ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $iRemove = ' & $iRemove & @CRLF) ;### Debug Console Local $hSearch = FileFindFirstFile($sVolumeNameTestDir & "\*.*") ;FindFirstFile succeeds, but FindNextFile fails to find anything If $hSearch = -1 Then ConsoleWrite("Error: No files/directories matched the search pattern." & @CRLF) Else Local $sFileName = "", $iResult = 0 While 1 $sFileName = FileFindNextFile($hSearch) ;FindNextFile Fails If @error Then ConsoleWrite("No more files: exiting... FAIL here" & @CRLF) ExitLoop EndIf $iResult = MsgBox(7096, "", "File: " & $sFileName) WEnd FileClose($hSearch) EndIf $iDosMove = RunWait(@Comspec & ' /k Move "' & $sVolumeNameTestDir & '" ' & @TempDir) ;this works :-) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $iDosMove = ' & $iDosMove & @CRLF) ;### Debug Console Func _GetVolumeNameForVolumeMountPoint($sMountPoint) Local $tBuffer, $pBuffer, $aCall $tBuffer = DllStructCreate("wchar buffer[256]") $pBuffer = DllStructGetPtr($tBuffer) $aCall = DllCall("kernel32.dll", "bool", "GetVolumeNameForVolumeMountPointW", "wstr", $sMountPoint, "ptr", $pBuffer, "dword", 256) If @error Then ConsoleWrite("! ERROR: " & @error & @CRLF) Return SetError(1, 0, -1) EndIf Return DllStructGetData($tBuffer, 1) EndFunc
Attachments (0)
Change History (1)
comment:1 Changed 10 years ago by Jon
- Resolution set to No Bug
- Status changed from new to closed
Guidelines for posting comments:
- You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
- In-depth discussions should take place on the forum.
For more information see the full version of the ticket guidelines here.
Note: See
TracTickets for help on using
tickets.
Documented here:
http://www.autoitscript.com/forum/topic/162588-extended-length-support-in-file-functions-beta-for-reference/