Skip to content

Commit

Permalink
#25 added AppContext.BaseDirectory for getting Resource files (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
knysh authored Sep 24, 2019
1 parent ff674a7 commit 83dcd68
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static string GetTextFromEmbeddedResource(string embeddedResourcePath, As
/// <returns>Text of the file.</returns>
public static string GetTextFromResource(string fileName)
{
return GetTextFromFile(new FileInfo(Path.Combine(ResourcesFolder, fileName)));
return GetTextFromFile(GetResourceFile(fileName));
}

/// <summary>
Expand All @@ -53,7 +53,7 @@ public static string GetTextFromResource(string fileName)
/// <returns>True if exists and false otherwise</returns>
public static bool IsResourceFileExist(string fileName)
{
var fileInfo = new FileInfo(Path.Combine(ResourcesFolder, fileName));
var fileInfo = GetResourceFile(fileName);
return fileInfo.Exists;
}

Expand All @@ -69,5 +69,10 @@ public static string GetTextFromFile(FileInfo fileInfo)
return reader.ReadToEnd();
}
}

private static FileInfo GetResourceFile(string fileName)
{
return new FileInfo(Path.Combine(AppContext.BaseDirectory, ResourcesFolder, fileName));
}
}
}

0 comments on commit 83dcd68

Please sign in to comment.