mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 19:48:20 +02:00
Added some extra platform errors
This commit is contained in:
parent
84f03abcc7
commit
1dae16ac57
2 changed files with 24 additions and 4 deletions
|
@ -72,7 +72,22 @@ namespace System.IO
|
|||
}
|
||||
}
|
||||
|
||||
public static Result<void> CreateShortcut(StringView linkPath, StringView targetPath, StringView arguments, StringView workingDirectory, StringView description)
|
||||
public enum ShellError
|
||||
{
|
||||
case AccessDenied;
|
||||
case UnknownError;
|
||||
|
||||
public this(Windows.COM_IUnknown.HResult result)
|
||||
{
|
||||
switch (result)
|
||||
{
|
||||
case .E_ACCESSDENIED: this = .AccessDenied;
|
||||
default: this = .UnknownError;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Result<void, ShellError> CreateShortcut(StringView linkPath, StringView targetPath, StringView arguments, StringView workingDirectory, StringView description)
|
||||
{
|
||||
COM_IShellLink* shellLink = null;
|
||||
COM_IPersistFile* persistFile = null;
|
||||
|
@ -88,7 +103,9 @@ namespace System.IO
|
|||
mixin TryHR(Windows.COM_IUnknown.HResult result)
|
||||
{
|
||||
if (result != .OK)
|
||||
return .Err;
|
||||
{
|
||||
return .Err(ShellError(result));
|
||||
}
|
||||
}
|
||||
|
||||
TryHR!(Windows.COM_IUnknown.CoCreateInstance(ref COM_IShellLink.sCLSID, null, .INPROC_SERVER, ref COM_IShellLink.sIID, (void**)&shellLink));
|
||||
|
|
|
@ -30,7 +30,8 @@ namespace System
|
|||
AccessError,
|
||||
PartialData,
|
||||
TempFileError,
|
||||
Timeout
|
||||
Timeout,
|
||||
NotEmpty
|
||||
};
|
||||
|
||||
public struct BfpCritSect {}
|
||||
|
@ -242,7 +243,8 @@ namespace System
|
|||
ShareError = (int)Result.ShareError,
|
||||
AccessError = (int)Result.AccessError,
|
||||
PartialData = (int)Result.PartialData,
|
||||
InsufficientBuffer = (int)Result.InsufficientBuffer
|
||||
InsufficientBuffer = (int)Result.InsufficientBuffer,
|
||||
NotEmpty = (int)Result.NotEmpty
|
||||
};
|
||||
|
||||
[StdCall, CLink]
|
||||
|
@ -397,6 +399,7 @@ namespace System
|
|||
Home,
|
||||
System,
|
||||
Desktop,
|
||||
Desktop_Common,
|
||||
AppData_Local,
|
||||
AppData_LocalLow,
|
||||
AppData_Roaming,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue