If I use the code below and the library creation tool of the IDE of 'PF Shadoko', this goes well with;
I use Purebasic 6.20.
-PureBasic X64, Lib_Forcedirectories ("C: \ dump \ 1 \ 2 \ 3 \ 4 \ 5 \") -> does not give Error.
and with the same tool but with Purebasic X86
-Purebasic X86, Lib_Forcedirectories ("C: \ dump \ 1 \ 2 \ 3 \ 4 \ 5 \") -> Gives Error.
Code: Select all
DisablePureLibrary ForceDirectories
ProcedureDLL Lib_ForceDirectories(Dir.s)
Static TmpDir.s, Init
Protected Result
If Len(Dir) = 0
ProcedureReturn #False
Else
If Not Init
TmpDir = Dir
Init = #True
EndIf
If (Right(Dir, 1) = "\")
Dir = Left(Dir, Len(Dir) - 1)
EndIf
If (Len(Dir) < 3) Or FileSize(Dir) = -2 Or GetPathPart(Dir) = Dir
If FileSize(TmpDir) = -2
Result = #True
EndIf
TmpDir = "": Init = #False
ProcedureReturn Result
EndIf
Lib_ForceDirectories(GetPathPart(Dir))
ProcedureReturn CreateDirectory(Dir)
EndIf
EndProcedure
Little_man