summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/ModHelpers
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2017-11-02 01:34:21 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2017-11-02 01:34:21 -0400
commita6071feaf84518c436fba0d148e3ea7d547663da (patch)
treebf19e8a2f69075b860ce6b2ef32a1ee2be3308a6 /src/SMAPI/Framework/ModHelpers
parente0b72374cd14298aacc6f71dc391fdc9814be37c (diff)
downloadSMAPI-a6071feaf84518c436fba0d148e3ea7d547663da.tar.gz
SMAPI-a6071feaf84518c436fba0d148e3ea7d547663da.tar.bz2
SMAPI-a6071feaf84518c436fba0d148e3ea7d547663da.zip
fix custom asset loads failing on Linux/Mac (#383)
Diffstat (limited to 'src/SMAPI/Framework/ModHelpers')
-rw-r--r--src/SMAPI/Framework/ModHelpers/ContentHelper.cs22
1 files changed, 2 insertions, 20 deletions
diff --git a/src/SMAPI/Framework/ModHelpers/ContentHelper.cs b/src/SMAPI/Framework/ModHelpers/ContentHelper.cs
index be9594ee..7665eb78 100644
--- a/src/SMAPI/Framework/ModHelpers/ContentHelper.cs
+++ b/src/SMAPI/Framework/ModHelpers/ContentHelper.cs
@@ -26,9 +26,6 @@ namespace StardewModdingAPI.Framework.ModHelpers
/// <summary>The absolute path to the mod folder.</summary>
private readonly string ModFolderPath;
- /// <summary>The path to the mod's folder, relative to the game's content folder (e.g. "../Mods/ModName").</summary>
- private readonly string ModFolderPathFromContent;
-
/// <summary>The friendly mod name for use in errors.</summary>
private readonly string ModName;
@@ -73,7 +70,6 @@ namespace StardewModdingAPI.Framework.ModHelpers
this.ContentManager = contentManager;
this.ModFolderPath = modFolderPath;
this.ModName = modName;
- this.ModFolderPathFromContent = this.ContentManager.GetRelativePath(modFolderPath);
this.Monitor = monitor;
}
@@ -102,7 +98,7 @@ namespace StardewModdingAPI.Framework.ModHelpers
throw GetContentError($"there's no matching file at path '{file.FullName}'.");
// get asset path
- string assetName = this.GetModAssetPath(key, file.FullName);
+ string assetName = this.ContentManager.GetAssetNameFromFilePath(file.FullName);
// try cache
if (this.ContentManager.IsLoaded(assetName))
@@ -151,7 +147,7 @@ namespace StardewModdingAPI.Framework.ModHelpers
case ContentSource.ModFolder:
FileInfo file = this.GetModFile(key);
- return this.ContentManager.NormaliseAssetName(this.GetModAssetPath(key, file.FullName));
+ return this.ContentManager.NormaliseAssetName(this.ContentManager.GetAssetNameFromFilePath(file.FullName));
default:
throw new NotSupportedException($"Unknown content source '{source}'.");
@@ -356,19 +352,5 @@ namespace StardewModdingAPI.Framework.ModHelpers
// get file
return new FileInfo(path);
}
-
- /// <summary>Get the asset path which loads a mod folder through a content manager.</summary>
- /// <param name="localPath">The file path relative to the mod's folder.</param>
- /// <param name="absolutePath">The absolute file path.</param>
- private string GetModAssetPath(string localPath, string absolutePath)
- {
-#if SMAPI_FOR_WINDOWS
- // XNA doesn't allow absolute asset paths, so get a path relative to the content folder
- return Path.Combine(this.ModFolderPathFromContent, localPath);
-#else
- // MonoGame is weird about relative paths on Mac, but allows absolute paths
- return absolutePath;
-#endif
- }
}
}