Skip to content

Commit

Permalink
different issue with file creation in snap
Browse files Browse the repository at this point in the history
  • Loading branch information
EvilLord666 committed Mar 5, 2024
1 parent e8696b9 commit 52fe4bd
Showing 1 changed file with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
Expand All @@ -14,9 +15,23 @@ public class DeviceConfigurationManager
{
public DeviceConfigurationManager(string configFile)
{
if (!File.Exists(configFile))
File.Create(configFile).Dispose();
_configFile = Path.GetFullPath(configFile);
try
{
if (!File.Exists(configFile))
File.Create(configFile).Dispose();
_configFile = Path.GetFullPath(configFile);
}
catch (Exception e)
{
if (OperatingSystem.IsLinux())
{
string deviceConfigFile = Path.Combine(Environment.SpecialFolder.Personal.ToString(), configFile);
if (!File.Exists(configFile))
File.Create(configFile).Dispose();
_configFile = Path.GetFullPath(configFile);
}
}

}

public ObservableCollection<SerialPortShortInfoModel> Load()
Expand Down

0 comments on commit 52fe4bd

Please sign in to comment.