-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathFilePathConvert.txt
49 lines (40 loc) · 1.15 KB
/
FilePathConvert.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
Let ( [
_slash = FileSlash ; // If ( Abs ( Get ( SystemPlatform ) ) = 2 ; "\\" ; "/" )
_sNode1 = Position ( path ; _slash ; 1 ; 1 ) ;
_sNode2 = Position ( path ; _slash ; 2 ; 1 ) ;
_sPathDir =
Case (
Left ( path ; 4 ) = "file" ; _sNode1 ;
Left ( path ; _sNode2 - 1 ) = _slash & "Volumes" ; _sNode2
) ;
_pathStripped = Middle ( path ; _sPathDir ; 999 ) ;
_prefixNew =
Case (
type = "posix" ;
_slash & "Volumes" ;
type = "filemaker" ;
If ( IsMac ; "filemac:" ; "filewin:" & _slash )
)
] ;
Case (
IsEmpty ( path ) or IsEmpty ( type ) ;
"" ;
_prefixNew & _pathStripped
)
)
/* —————————————————————————————— //
NAME:
FilePathConvert ( path ; type )
PURPOSE:
Changes path type.
EXAMPLES:
(Assuming Mac OS)
FilePathConvert ( "filemac:/Macintosh HD/Users/Admin/Desktop/text.txt" ;
"posix"
) = "/Volumes/Macintosh HD/Users/Admin/Desktop/text.txt"
FilePathConvert ( "/Volumes/Macintosh HD/Users/Admin/Desktop/text.txt" ;
"filemaker"
) = "filemac:/Macintosh HD/Users/Admin/Desktop/text.txt"
HISTORY:
Created: 2010-Mar-27 14h30 PST - Donovan A. Chandler
*/