Changeset 197 for Include/Classes/System/IO/Path.ab
- Timestamp:
- Mar 31, 2007, 9:58:19 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Include/Classes/System/IO/Path.ab
r142 r197 15 15 16 16 Static Function GetFileNameWithoutExtension(path As String) As String 17 Dim fileName As String 18 Dim extPos As Long 19 20 fileName = GetFileName(path) 21 extPos = getExtensionPosition(fileName) 17 Dim fileName = GetFileName(path) As String 18 Dim extPos = getExtensionPosition(fileName) As Long 22 19 If extPos = -1 Then Return "" 23 20 … … 34 31 35 32 Static Function GetExtension(path As String) As String 36 Dim extPos As Long 37 extPos = getExtensionPosition(path) 33 Dim extPos = getExtensionPosition(path) As Long 38 34 If extPos = -1 Then Return "" 39 35 … … 42 38 43 39 Static Function ChangeExtension(path As String, extension As String) As String 44 Dim extPos As Long 45 extPos = getExtensionPosition(path) 40 Dim extPos = getExtensionPosition(path) As Long 46 41 If extPos => 0 Then 47 42 path = path.Remove(extPos) … … 78 73 79 74 Static Function GetTempPath() As String 80 Dim size = GetTempPath(0, 0 81 Dim tempPath = _System_malloc(size) )75 Dim size = GetTempPath(0, 0) 76 Dim tempPath = _System_malloc(size) 82 77 __GetTempPath(size, tempPath) 83 78 GetTempPath = tempPath … … 94 89 95 90 Static Function GetDirectoryName(path As String) As String 96 Dim lastSepPos As Long 97 lastSepPos = getLastSeparatorPosision(path) 91 Dim lastSepPos = getLastSeparatorPosision(path) As Long 98 92 If lastSepPos = -1 Then Return "" 99 93 … … 114 108 115 109 Static Function IsPathRooted(path As String) As Boolean 116 Dim volSepChar As String(Chr$(VolumeSeparatorChar)) 117 If path.IndexOf(volSepChar, 1, 1) = 1 Then 110 If path.IndexOf(Chr$(VolumeSeparatorChar), 1, 1) = 1 Then 118 111 Return True 119 112 Else … … 123 116 124 117 Static Function Combine(path1 As String, path2 As String) As String 125 Dim volSepChar As String(Chr$(VolumeSeparatorChar)) 126 Dim dirSepChar As String(Chr$(DirectorySeparatorChar)) 127 If path1.LastIndexOf(volSepChar) And path1.Length = 2 Then 118 If path1.LastIndexOf(Chr$(VolumeSeparatorChar)) And path1.Length = 2 Then 128 119 Return path1 + path2 129 120 End If 130 121 131 If path1.LastIndexOf( dirSepChar, ELM(path1.Length), 1) = -1 Then132 Return path1 + dirSepChar+ path2122 If path1.LastIndexOf(Chr$(DirectorySeparatorChar), ELM(path1.Length), 1) = -1 Then 123 Return path1 + Chr$(DirectorySeparatorChar) + path2 133 124 Else 134 125 Return path1 + path2 … … 138 129 Private 139 130 Static Function getExtensionPosition(ByRef path As String) As Long 140 Dim lastSepPos As Long 141 lastSepPos = getLastSeparatorPosision(path) 131 Dim lastSepPos = getLastSeparatorPosision(path) As Long 142 132 getExtensionPosition = path.LastIndexOf(".", ELM(path.Length), path.Length - lastSepPos) 143 133 End Function 144 134 145 135 Static Function getLastSeparatorPosision(ByRef path As String) As Long 146 Dim lastSepPos As Long 147 Dim dirSepChar As String(Chr$(DirectorySeparatorChar)) 148 Dim volSepChar As String(Chr$(VolumeSeparatorChar)) 149 lastSepPos = path.LastIndexOf(dirSepChar) 136 Dim lastSepPos = path.LastIndexOf(Chr$(DirectorySeparatorChar)) As Long 150 137 If lastSepPos <> -1 Then Return lastSepPos 151 138 152 lastSepPos = path.LastIndexOf(dirSepChar) 153 If lastSepPos <> -1 Then Return lastSepPos 154 155 lastSepPos = path.LastIndexOf(volSepChar) 139 lastSepPos = path.LastIndexOf(Chr$(VolumeSeparatorChar)) 156 140 Return lastSepPos 157 141 End Function
Note:
See TracChangeset
for help on using the changeset viewer.