#1678 closed Bug (No Bug)
DirCreate() can return 1 (success) without creating any directory
| Reported by: | anonymous | Owned by: | |
|---|---|---|---|
| Milestone: | Component: | AutoIt | |
| Version: | 3.3.6.1 | Severity: | None |
| Keywords: | Cc: |
Description
AutoIt:3.3.6.1
Os:WIN_XP/X86/Service Pack 3
Language:0409 Keyboard:00000809
Cpu:X64
When DirCreate() is passed certain invalid paths, for example "C:xxx\zzz", it returns 1 indicating success even though no path has been created.
$Result = DirCreate("C:ZZZ\XXX")
MsgBox(0,"DirCreate", "DirCreate returned " & $Result)
Attachments (0)
Change History (6)
follow-up: 2 comment:1 by , on Jun 16, 2010 at 12:27:42 PM
comment:2 by , on Jun 16, 2010 at 10:19:42 PM
Replying to mvg:
NoBug
DirCreate("C:ZZZ\XXX") will actually create the requested folder(s). At the drive root level in your case, so "C:\ZZZ\XXX". So the returned value is correct in this case.
That is not the case on the 3 PC I've tried it on. No directories are created.
comment:3 by , on Jun 17, 2010 at 6:06:18 AM
Than a small example script is needed that shows when this is the case.
Using the code you provided is not showing the problem you describe. (at least not on my system) Ergo: NoBug.
If its something OS or PC specific. You need to find out what -> forum being a better place for that.
Just in case. I'm using similar OS specs here, Just not on a 64bit CPU.
comment:4 by , on Jun 17, 2010 at 7:53:23 AM
I cannot reproduce it either.
I don't think it can be related with a 64bit CPU running an X86 Windows
Unless you provide an script that can reproduce it, I am afraid to close it as "Work for me"
comment:5 by , on Jun 18, 2010 at 9:31:38 PM
I have now found what is happening. The directories are being created, not in the root of the drive but in whatever the working directory happens to be at the time. My expectation was that with a malformed path such as "c:xxx" the directory would not be created or possibly in the root of the drive as suggested by mvg.
FileChangeDir(@TempDir) ;Just to make sure that the drive root is not the working directory
$res = DirCreate("C:xxx\yyy\zzz")
MsgBox(0,"DirCreate 'C:xxx\yyy\zzz'", "DirCreate returned " & $Res)
;Returns 1 for me
$res = FileExists("C:xxx\yyy\zzz")
MsgBox(0,"FileExists 'C:xxx\yyy\zzz'", "FileExists returned " & $Res)
;Returns 1 for me
$res = FileExists("C:\xxx\yyy\zzz")
MsgBox(0,"FileExists 'C:\xxx\yyy\zzz'", "FileExists returned " & $Res)
;Returns 0 for me
$res = FileExists(@WorkingDir & "\xxx\yyy\zzz")
MsgBox(0,"FileExists '@workingDir & \xxx\yyy\zzz'", "FileExists returned " & $Res)
;Returns 1 for me
Hoverver this replicates what the cmd.exe MD command does, so no bug
comment:6 by , on Jun 19, 2010 at 6:40:27 AM
| Resolution: | → No Bug |
|---|---|
| Status: | new → closed |

NoBug
DirCreate("C:ZZZ\XXX") will actually create the requested folder(s). At the drive root level in your case, so "C:\ZZZ\XXX". So the returned value is correct in this case.