summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.Tizen/ResourcePath.cs
blob: d2387793511ada3fe1746ec7f9f165d3a136f906 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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;
		}
	}
}