Skip to content

Commit bbd54be

Browse files
committed
Fix error
1 parent d092ce2 commit bbd54be

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

NodeSwap/NodeSwap.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
45
<OutputType>Exe</OutputType>
56
<TargetFramework>net8.0-windows</TargetFramework>
67
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>

NodeSwap/Services/FileSystemService.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
namespace NodeSwap.Services;
77

8-
public class FileSystemService : IFileSystem
8+
public partial class FileSystemService : IFileSystem
99
{
1010
public bool FileExists(string path) => File.Exists(path);
1111

@@ -30,8 +30,9 @@ public bool CreateSymbolicLink(string linkPath, string targetPath, bool isDirect
3030
return result;
3131
}
3232

33-
[DllImport("kernel32.dll")]
34-
private static extern bool CreateSymbolicLinkWin32(
33+
[LibraryImport("kernel32.dll", EntryPoint = "CreateSymbolicLink", SetLastError = true, StringMarshalling = StringMarshalling.Utf16)]
34+
[return: MarshalAs(UnmanagedType.Bool)]
35+
private static partial bool CreateSymbolicLinkWin32(
3536
string lpSymlinkFileName,
3637
string lpTargetFileName,
3738
SymbolicLink dwFlags);

0 commit comments

Comments
 (0)