Skip to content

Commit 311c950

Browse files
committed
simplify
1 parent 6d55077 commit 311c950

File tree

3 files changed

+3
-15
lines changed

3 files changed

+3
-15
lines changed

+stdlib/+dotnet/disk_available.m

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,13 @@
22

33
function i = disk_available(file)
44

5-
i = uint64.empty;
6-
if ~stdlib.exists(file)
7-
return
8-
end
9-
105
try
116
% absolutizing is necessary for Windows especially
127
i = System.IO.DriveInfo(System.IO.Path.GetFullPath(file)).AvailableFreeSpace();
138
% https://learn.microsoft.com/en-us/dotnet/api/system.io.driveinfo.availablefreespace
149
catch e
1510
dotnetException(e)
11+
i = [];
1612
end
1713

1814
i = uint64(i);

+stdlib/+dotnet/disk_capacity.m

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,13 @@
22

33
function i = disk_capacity(file)
44

5-
i = uint64.empty;
6-
if ~stdlib.exists(file)
7-
return
8-
end
9-
105
try
116
% absolutizing is necessary for Windows especially
127
i = System.IO.DriveInfo(System.IO.Path.GetFullPath(file)).TotalSize();
138
% https://learn.microsoft.com/en-us/dotnet/api/system.io.driveinfo.totalsize
149
catch e
1510
dotnetException(e)
11+
i = [];
1612
end
1713

1814
i = uint64(i);

+stdlib/+dotnet/filesystem_type.m

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,13 @@
33
function t = filesystem_type(file)
44

55

6-
t = '';
7-
if ~stdlib.exists(file)
8-
return
9-
end
10-
116
% https://learn.microsoft.com/en-us/dotnet/api/system.io.driveinfo.driveformat
127

138
try
149
t = char(System.IO.DriveInfo(System.IO.Path.GetFullPath(file)).DriveFormat);
1510
catch e
1611
dotnetException(e)
12+
t = '';
1713
end
1814

1915
end

0 commit comments

Comments
 (0)