Changeset 142 for Include/Classes/System/IO/Path.ab
- Timestamp:
- Mar 9, 2007, 10:15:34 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Include/Classes/System/IO/Path.ab
r136 r142 1 ' System/IO/Path.ab 2 3 #require <Classes/System/Environment.ab> 4 1 5 Class Path 2 6 Public … … 36 40 Return path.Remove(0, extPos) 37 41 End Function 38 42 39 43 Static Function ChangeExtension(path As String, extension As String) As String 40 44 Dim extPos As Long … … 49 53 Static Function HasExtension(ByRef path As String) As Boolean 50 54 If GetExtension(path) <> "" Then 51 Return _System_TRUE55 Return True 52 56 Else 53 Return _System_FALSE57 Return False 54 58 End If 55 59 End Function … … 74 78 75 79 Static Function GetTempPath() As String 76 GetTempPath.ReSize(__GetTempPath(0, 0) - 1) 77 __GetTempPath(GetTempPath.Length + 1, GetTempPath) 80 Dim size = GetTempPath(0, 0 81 Dim tempPath = _System_malloc(size)) 82 __GetTempPath(size, tempPath) 83 GetTempPath = tempPath 84 _System_free(tempPath) 78 85 End Function 79 86 80 87 Static Function GetFullPath(path As String) As String 81 Dim cd As String 82 Dim dirSepChar As String(Chr$(DirectorySeparatorChar)) 83 If IsPathRooted(path) Then Return path 84 85 cd.ReSize = GetCurrentDirectory(0, 0) - 1 86 GetCurrentDirectory(cd.Length + 1, cd) 87 Return cd + dirSepChar + path 88 If IsPathRooted(path) Then 89 Return path 90 Else 91 Return Environment.CurrentDirectory + Chr$(DirectorySeparatorChar) + path 92 End If 88 93 End Function 89 94 … … 108 113 End Function 109 114 110 Static Function IsPathRooted(path As String) As B OOL115 Static Function IsPathRooted(path As String) As Boolean 111 116 Dim volSepChar As String(Chr$(VolumeSeparatorChar)) 112 117 If path.IndexOf(volSepChar, 1, 1) = 1 Then 113 Return _System_TRUE118 Return True 114 119 Else 115 Return _System_FALSE120 Return False 116 121 End If 117 122 End Function
Note:
See TracChangeset
for help on using the changeset viewer.