Check working dir if translations can't be found relative to exe

Branch_2.1.x
Nathan Crawford 2016-02-18 18:30:04 -05:00
rodzic b490109711
commit c793ee83d2
1 zmienionych plików z 15 dodań i 1 usunięć

Wyświetl plik

@ -122,8 +122,22 @@ namespace embroideryReader
private string GetBasePath()
{
// Build the path that should be used by default
string exePath = System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath);
return System.IO.Path.Combine(exePath, TRANSLATIONS_FOLDER);
exePath = System.IO.Path.Combine(exePath, TRANSLATIONS_FOLDER);
// If the default path exists, use it
if (System.IO.Directory.Exists(exePath))
{
return exePath;
}
// If the translations folder exists in the current working directory, use it
else if(System.IO.Directory.Exists(TRANSLATIONS_FOLDER))
{
return TRANSLATIONS_FOLDER;
}
// No usable translations folder found
throw new Exception("Unable to locate a suitable translations directory");
}
// Returns the names of available translations