Ignore:
Timestamp:
Feb 17, 2008, 12:51:20 PM (16 years ago)
Author:
OverTaker
Message:

System/IO/Directory.ab実装。例外処理を徐々に実装。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Include/Classes/System/IO/DirectoryInfo.ab

    r406 r407  
    5555    */
    5656    Sub Create()
    57         CreateDirectory(ToTCStr(FullPath), NULL)
     57        If CreateDirectory(ToTCStr(FullPath), NULL) = False Then
     58            Dim error = GetLastError()
     59            Select Case error
     60                Case ERROR_ALREADY_EXISTS
     61                    Throw New IOException("DirectoryInfo.CreateDirectory: The directory has already existed.")
     62                Case Else
     63                    Throw New IOException("DirectoryInfo.CreateDirectory: Failed to CreateDirectory")
     64
     65            End Select
     66        End If
    5867    End Sub
    5968
     
    98107
    99108            If SHFileOperation(op) <> 0 Then
    100                 ' TODO: エラー処理
    101                 debug
     109                Throw New IOException("DirectoryInfo.Delete: Failed to SHFileOperation.")
    102110            End If
    103111        Else
     
    254262        find = FindFirstFile(ToTCStr(Path.Combine(FullPath, searchPattern)), findData)
    255263        If find = INVALID_HANDLE_VALUE Then
    256             Return New List<DirectoryInfo>
     264            Throw New IOException("DirectoryInfo.GetFileSystemInfos: Failed to FindFirstFile.")
     265            Return Nothing
    257266        End If
    258267
     
    274283            Return files
    275284        Else
    276             debug 'Exception
     285            Throw New IOException("DirectoryInfo.GetFileSystemInfos: Failed to FindNextFile.")
    277286            Return Nothing
    278287        End If
     
    287296    Sub MoveTo(destDirName As String)
    288297        If MoveFile(ToTCStr(FullPath), ToTCStr(destDirName)) = FALSE Then
    289             'Exception
     298            Throw New IOException("DirectoryInfo.MoveTo: Failed to MoveFile.")
    290299        End If
    291300    End Sub
Note: See TracChangeset for help on using the changeset viewer.