public static EsDriveInfo FromDirectory(string path, ILogger log) { try { string driveName; if (OS.IsUnix) { driveName = GetDirectoryRootInUnix(path, log); if (driveName == null) return null; } else { driveName = Directory.GetDirectoryRoot(path); } var drive = new DriveInfo(driveName); var esDrive = new EsDriveInfo(drive.Name, drive.TotalSize, drive.AvailableFreeSpace); return esDrive; } catch (Exception ex) { log.Debug("Error while reading drive info for path {0}. Message: {1}.", path, ex.Message); return null; } }
public static EsDriveInfo FromDirectory(string path, ILogger log) { try { string driveName; if (OS.IsLinux) { driveName = GetDirectoryRootInLinux(path, log); if (driveName == null) { return(null); } } else { driveName = Directory.GetDirectoryRoot(path); } var drive = new DriveInfo(driveName); var esDrive = new EsDriveInfo(drive.Name, drive.TotalSize, drive.AvailableFreeSpace); return(esDrive); } catch (Exception ex) { log.DebugException(ex, "Error while reading drive info for path {0}", path); return(null); } }
public static EsDriveInfo FromDirectory(string path, ILogger log) { try { if (OS.IsUnix) { return(GetEsDriveInfoUnix(path, log)); } var driveName = Directory.GetDirectoryRoot(path); var drive = new DriveInfo(driveName); var esDrive = new EsDriveInfo(drive.Name, drive.TotalSize, drive.AvailableFreeSpace); return(esDrive); } catch (Exception ex) { log.Debug("Error while reading drive info for path {path}. Message: {e}.", path, ex.Message); return(null); } }