Skip to content

Commit 5fe6fa1

Browse files
authored
#149 added getCurrentDirectory for Resources files (#150)
+semver: feature * #149 added getCurrentDirectory for Resuorces files * #149 appdomain -> app context
1 parent 83bd045 commit 5fe6fa1

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Aquality.Selenium/src/Aquality.Selenium/Utilities/FileReader.cs

+7-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public static string GetTextFromEmbeddedResource(string embeddedResourcePath, As
4343
/// <returns>Text of the file.</returns>
4444
public static string GetTextFromResource(string fileName)
4545
{
46-
return GetTextFromFile(new FileInfo(Path.Combine(ResourcesFolder, fileName)));
46+
return GetTextFromFile(GetResourceFile(fileName));
4747
}
4848

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

@@ -69,5 +69,10 @@ public static string GetTextFromFile(FileInfo fileInfo)
6969
return reader.ReadToEnd();
7070
}
7171
}
72+
73+
private static FileInfo GetResourceFile(string fileName)
74+
{
75+
return new FileInfo(Path.Combine(AppContext.BaseDirectory, ResourcesFolder, fileName));
76+
}
7277
}
7378
}

0 commit comments

Comments
 (0)