Linux: Fixed crash at startup when folders do not exist
This commit is contained in:
parent
7c11e8154a
commit
7df6390b41
1 changed files with 16 additions and 5 deletions
|
@ -43,6 +43,17 @@ namespace Mesen.GUI.Config
|
|||
string baseFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), ".local", "share");
|
||||
string desktopFolder = Path.Combine(baseFolder, "applications");
|
||||
string mimeFolder = Path.Combine(baseFolder, "mime");
|
||||
string iconFolder = Path.Combine(baseFolder, "icons");
|
||||
if(!Directory.Exists(mimeFolder)) {
|
||||
Directory.CreateDirectory(mimeFolder);
|
||||
}
|
||||
if(!Directory.Exists(iconFolder)) {
|
||||
Directory.CreateDirectory(iconFolder);
|
||||
}
|
||||
if(!Directory.Exists(desktopFolder)) {
|
||||
Directory.CreateDirectory(desktopFolder);
|
||||
}
|
||||
|
||||
|
||||
//Use a GUID to get a unique filename and then delete old files to force a reset of file associations
|
||||
//Otherwise they are sometimes not refreshed properly
|
||||
|
@ -66,7 +77,7 @@ namespace Mesen.GUI.Config
|
|||
CreateMimeType("x-mesen-unif", "unf", "NES Rom (UNIF)", mimeTypes, preferenceInfo.AssociateUnfFiles);
|
||||
|
||||
//Icon used for shortcuts
|
||||
Mesen.GUI.Properties.Resources.MesenLogo.Save(Path.Combine(baseFolder, "icons", "MesenIcon.png"), ImageFormat.Png);
|
||||
Mesen.GUI.Properties.Resources.MesenLogo.Save(Path.Combine(iconFolder, "MesenIcon.png"), ImageFormat.Png);
|
||||
|
||||
File.WriteAllText(desktopFile,
|
||||
"[Desktop Entry]" + Environment.NewLine +
|
||||
|
|
Loading…
Add table
Reference in a new issue