The biggest issues I have with common directories between Linux and Windows are the characters ":", "?" and the double quotation mark. I use them quite often. Also it is annoying that Windows does not care about lower and upper case characters.skywalk wrote:Yes, that makes sense. I am merely trying to maintain compatibility with Windows transfers between Linux servers.
CreateDirectory() recursively or CreatePath()
- NicTheQuick
- Addict
- Posts: 1504
- Joined: Sun Jun 22, 2003 7:43 pm
- Location: Germany, Saarbrücken
- Contact:
Re: CreateDirectory() recursively or CreatePath()
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
Re: CreateDirectory() recursively or CreatePath()
My approach is KISS. The filenames just have to be unique without so much information conveyed. The contents are what matters.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
Re: CreateDirectory() recursively or CreatePath()
I made an improvement to the ForceDirectories function
1. #PS$ makes it cross-platform
2. If FileSize(Dir) = -2 moved to the beginning, since most people use it as a criterion
3. Dir = RTrim(Dir, #PS$) - eliminated the character check and immediately trimmed it so as not to check it twice
4. Asc(Dir) is faster than Len(Dir)
5. result = -1 ; additional information about the fact that the folder already exists without using CreateDirectory(Dir)
Code: Select all
Procedure ForceDirectories(Dir.s)
Static tmpDir.s, Init
Protected result
If Asc(Dir)
If Not Init
tmpDir = Dir
Init = 1
EndIf
Dir = RTrim(Dir, #PS$)
If FileSize(Dir) = -2 Or (Len(Dir) < 3) Or GetPathPart(Dir) = Dir
If FileSize(tmpDir) = -2
result = -1
EndIf
tmpDir = ""
Init = 0
ProcedureReturn result
EndIf
ForceDirectories(GetPathPart(Dir))
ProcedureReturn CreateDirectory(Dir)
Else
ProcedureReturn 0
EndIf
EndProcedure
2. If FileSize(Dir) = -2 moved to the beginning, since most people use it as a criterion
3. Dir = RTrim(Dir, #PS$) - eliminated the character check and immediately trimmed it so as not to check it twice
4. Asc(Dir) is faster than Len(Dir)
5. result = -1 ; additional information about the fact that the folder already exists without using CreateDirectory(Dir)