Changeset 197 for Include/Classes


Ignore:
Timestamp:
Mar 31, 2007, 9:58:19 AM (18 years ago)
Author:
OverTaker
Message:

タイプミスと若干のコード修整

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Include/Classes/System/IO/Path.ab

    r142 r197  
    1515
    1616    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
    2219        If extPos = -1 Then Return ""
    2320
     
    3431
    3532    Static Function GetExtension(path As String) As String
    36         Dim extPos As Long
    37         extPos = getExtensionPosition(path)
     33        Dim extPos = getExtensionPosition(path) As Long
    3834        If extPos = -1 Then Return ""
    3935
     
    4238
    4339    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
    4641        If extPos => 0 Then
    4742            path = path.Remove(extPos)
     
    7873
    7974    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)
    8277        __GetTempPath(size, tempPath)
    8378        GetTempPath = tempPath
     
    9489
    9590    Static Function GetDirectoryName(path As String) As String
    96         Dim lastSepPos As Long
    97         lastSepPos = getLastSeparatorPosision(path)
     91        Dim lastSepPos = getLastSeparatorPosision(path) As Long
    9892        If lastSepPos = -1 Then Return ""
    9993
     
    114108
    115109    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
    118111            Return True
    119112        Else
     
    123116
    124117    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
    128119            Return path1 + path2
    129120        End If
    130121
    131         If path1.LastIndexOf(dirSepChar, ELM(path1.Length), 1) = -1 Then
    132             Return path1 + dirSepChar + path2
     122        If path1.LastIndexOf(Chr$(DirectorySeparatorChar), ELM(path1.Length), 1) = -1 Then
     123            Return path1 + Chr$(DirectorySeparatorChar) + path2
    133124        Else
    134125            Return path1 + path2
     
    138129Private
    139130    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
    142132        getExtensionPosition = path.LastIndexOf(".", ELM(path.Length), path.Length - lastSepPos)
    143133    End Function
    144134
    145135    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
    150137        If lastSepPos <> -1 Then Return lastSepPos
    151138
    152         lastSepPos = path.LastIndexOf(dirSepChar)
    153         If lastSepPos <> -1 Then Return lastSepPos
    154 
    155         lastSepPos = path.LastIndexOf(volSepChar)
     139        lastSepPos = path.LastIndexOf(Chr$(VolumeSeparatorChar))
    156140        Return lastSepPos
    157141    End Function
Note: See TracChangeset for help on using the changeset viewer.