Skip to content
This repository has been archived by the owner on Aug 11, 2024. It is now read-only.

Commit

Permalink
Fix symbolic linker errors (#804)
Browse files Browse the repository at this point in the history
* fixed some issues with AccessViolationException errors that can happen sometimes

* handle a few exception types
  • Loading branch information
StephenHodgson authored Apr 2, 2021
1 parent be8e400 commit 080f1e3
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions Editor/Utilities/SymbolicLinks/SymbolicLinker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -453,23 +453,32 @@ private static bool VerifySymbolicLink(string targetAbsolutePath)
}
else
{
var tempFile = $"{targetAbsolutePath}/temp_test.txt";
var tempFile = $"{targetAbsolutePath}/symlink_temp.txt";

try
{
if (!File.Exists(tempFile))
{
File.CreateText(tempFile).Dispose();
var stream = File.CreateText(tempFile);
stream.Dispose();
stream.Close();
}

if (File.Exists(tempFile))
{
File.Delete(tempFile);
}
}
catch (DirectoryNotFoundException)
catch (Exception e)
{
return false;
switch (e)
{
case AccessViolationException _:
case IOException _:
return true;
default:
return false;
}
}
}

Expand Down

0 comments on commit 080f1e3

Please sign in to comment.