Verfasst: 20.05.2007 21:41



Code: Alles auswählen
Procedure CreateTopDirectory(path.s)
If Right(path.s,1)<>"\":path.s+"\":EndIf:ProcedureReturn MakeSureDirectoryPathExists_(@path.s)
EndProcedure
Code: Alles auswählen
Procedure CreateTopDirectory(path.s)
If Right(path.s,1)<>"\":path.s+"\":EndIf:ProcedureReturn MakeSureDirectoryPathExists_(@path.s)
EndProcedure
weder noch.AND51 hat geschrieben:@ Xaby:
Nett, dein CompilerIf, aber ich würde die Variable doch lieber in die Prozedur packen, statt außerhalb? Also als protected, statt global?!
Code: Alles auswählen
CompilerIf #PB_Compiler_OS = #PB_OS_Windows
#Seperator$ ="" ; für Windows
CompilerElse
#Seperator$ ="/" ; für MacOS, Linux
CompilerEndIf
Code: Alles auswählen
Procedure CreateTopDirectory2(path.s)
ProcedureReturn MakeSureDirectoryPathExists_(@path.s)
EndProcedure
Debug Str(CreateTopDirectory2("c:\Test\testA")) + " = Test ohne \"
Procedure CreateTopDirectory(path.s)
If Right(path.s,1)<>"\":path.s+"\":EndIf:ProcedureReturn MakeSureDirectoryPathExists_(@path.s)
EndProcedure
Debug Str(CreateTopDirectory("c:\Test\testB")) + " = Test ohne \"
Code: Alles auswählen
file.s = "c:\test\testa\blub.txt"
MakeSureDirectoryPathExists_(GetPathPart(file))
CopyFile(bla, file)
Code: Alles auswählen
Procedure CreateTopDirectory(path.s)
path.s = ReplaceString(path.s,"\\","\"):If Right(path.s,1)<>"\":path.s+"\":EndIf
Debug path.s
ProcedureReturn MakeSureDirectoryPathExists_(@path.s)
EndProcedure
So etwas soll vorkommenWer natürlich dem User erlaubt den Pfad per Hand einzutragen,
Code: Alles auswählen
Procedure CreateTopDirectory(path.s)
path.s = ReplaceString(path.s,"\\","\"):If Right(path.s,1)<>"\":path.s+"\":EndIf
Debug path.s
ProcedureReturn MakeSureDirectoryPathExists_(@path.s)
EndProcedure
Debug CreateTopDirectory("c:\Test\testD")
Debug CreateTopDirectory("c:\Test\testE\")
Debug CreateTopDirectory("c:\Test\testF\\")
So etwas soll vorkommenWer natürlich dem User erlaubt den Pfad per Hand einzutragen,