*/
using System;
+using System.IO;
using Tizen.Internals.Errors;
namespace Tizen.Applications
{
/// <summary>
- /// Class for getting resource path.
+ /// The class for getting the resource path.
/// </summary>
public static class ResourceManager
{
/// <summary>
- /// Enumeration for Resource category.
+ /// Enumeration for the resource category.
/// </summary>
public enum Category : int
{
}
/// <summary>
- /// Converts resource ID to path name.
+ /// Converts resource ID to the path name.
/// </summary>
- /// <param name="category">Category to search</param>
- /// <param name="id">ID to search</param>
- /// <returns>Found resource path</returns>
- /// <exception cref="InvalidOperationException">Thrown in case of failed conditions</exception>
+ /// <param name="category">Category to search.</param>
+ /// <param name="id">ID to search.</param>
+ /// <returns>Found resource path.</returns>
+ /// <exception cref="InvalidOperationException">Thrown in case of failed conditions.</exception>
public static string GetPath(Category category, string id)
{
string path;
}
/// <summary>
- /// Converts resource ID to path name.
+ /// Converts resource ID to the path name.
/// </summary>
- /// <param name="category">Category to search</param>
- /// <param name="id">ID to search</param>
- /// <returns>Found resource path or null when the resource doesn't exist</returns>
- /// <exception cref="InvalidOperationException">Thrown in case of failed conditions</exception>
+ /// <param name="category">Category to search.</param>
+ /// <param name="id">ID to search.</param>
+ /// <returns>Found resource path or null when the resource doesn't exist.</returns>
+ /// <exception cref="InvalidOperationException">Thrown in case of failed conditions.</exception>
public static string TryGetPath(Category category, string id)
{
string path;
- ErrorCode err = AppResourceManagerGet(category, id, out path);
+ ErrorCode err;
+ string res;
+
+ if (Application.Current != null)
+ {
+ res = Application.Current.DirectoryInfo.Resource + "res.xml";
+ }
+ else
+ {
+ res = Interop.AppCommon.AppGetResourcePath() + "res.xml";
+ }
+
+ if (!File.Exists(res))
+ return null;
+ err = AppResourceManagerGet(category, id, out path);
switch (err)
{
case ErrorCode.InvalidParameter: