diff options
Diffstat (limited to 'Xamarin.Forms.Platform.Tizen/ResourcePath.cs')
-rw-r--r-- | Xamarin.Forms.Platform.Tizen/ResourcePath.cs | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/Xamarin.Forms.Platform.Tizen/ResourcePath.cs b/Xamarin.Forms.Platform.Tizen/ResourcePath.cs new file mode 100644 index 00000000..d2387793 --- /dev/null +++ b/Xamarin.Forms.Platform.Tizen/ResourcePath.cs @@ -0,0 +1,44 @@ +using System.IO; +#if NET45 +using System.Reflection; +#endif + +using AppFW = Tizen.Applications; + +namespace Xamarin.Forms.Platform.Tizen +{ + internal static class ResourcePath + { + public static string GetPath(string res) + { + if (Path.IsPathRooted(res)) + { + return res; + } + + AppFW.Application app = AppFW.Application.Current; + if (app != null) + { + string resPath = app.DirectoryInfo.Resource + res; + if (File.Exists(resPath)) + { + return resPath; + } + } + +#if NET45 + string exedir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + // ind resource in "exepath/../res/" + { + string resPath = exedir + "/../res/" + res; + if (File.Exists(resPath)) + { + return resPath; + } + } +#endif + + return res; + } + } +} |