Skip to content

Commit

Permalink
CYF 0.6.6 LTS 1
Browse files Browse the repository at this point in the history
  • Loading branch information
RhenaudTheLukark committed Jun 12, 2022
1 parent 587ef64 commit d4bba1c
Show file tree
Hide file tree
Showing 17 changed files with 553 additions and 741 deletions.
15 changes: 5 additions & 10 deletions Assets/Plugins/MoonSharp/Interpreter/CoreLib/LoadModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -286,19 +286,17 @@ public static DynValue __require_clr_impl(ScriptExecutionContext executionContex
}

// Check if the resource exists using the mod path
string modPath = pathSuffix;
string error;
try {
string modPath = pathSuffix;
ExplorePath(ref fileNameMod, ref modPath);
// Keep the mod path even if the file needs to exist
if (needsToExist && !new FileInfo(fileNameMod).Exists) throw new CYFException("The file " + fileNameMod + " doesn't exist.");
fileName = fileNameMod;

if (!needsAbsolutePath) {
Uri uriRel = new Uri(modPath).MakeRelativeUri(new Uri(fileName));
fileName = Uri.UnescapeDataString(uriRel.OriginalString);
}
if (needsAbsolutePath) return true;

if (needsToExist && !new FileInfo(fileNameMod).Exists) throw new CYFException("The file " + fileNameMod + " doesn't exist.");
Uri uriRel = new Uri(modPath + Path.DirectorySeparatorChar).MakeRelativeUri(new Uri(fileName));
fileName = Uri.UnescapeDataString(uriRel.OriginalString);
return true;
} catch (Exception e) { error = e.Message; }

Expand Down Expand Up @@ -342,9 +340,6 @@ public static DynValue __require_clr_impl(ScriptExecutionContext executionContex

fullPath = fullPath.Replace('\\', Path.DirectorySeparatorChar).Replace('/', Path.DirectorySeparatorChar);

if (!new DirectoryInfo(pathSuffix).Exists)
throw new CYFException("The root folder \"" + pathSuffix + "\" doesn't exist.");

// Get the folder containing the resource to load
string fileName = fullPath.Substring(fullPath.LastIndexOf(Path.DirectorySeparatorChar) + 1);
DirectoryInfo endFolder = new DirectoryInfo(fullPath.Substring(0, fullPath.LastIndexOf(Path.DirectorySeparatorChar)));
Expand Down
Loading

0 comments on commit d4bba1c

Please sign in to comment.