mirror of
https://github.com/ARMSX2/ARMSX1.git
synced 2026-08-24 16:53:35 -07:00
Harden UWP host logging path initialization
This commit is contained in:
@@ -1,26 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>armsx</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>armsx.app.0</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>armsx</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.10.4-alpha</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>0.10.4-alpha</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.9</string>
|
||||
<key>NSHighResolutionCapable</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 23 KiB |
@@ -1,135 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>files</key>
|
||||
<dict>
|
||||
<key>Resources/icons/AppIconLarge.png</key>
|
||||
<data>
|
||||
K/quJY2yLdHIZT79gWjPJYcuWhM=
|
||||
</data>
|
||||
</dict>
|
||||
<key>files2</key>
|
||||
<dict>
|
||||
<key>Libraries/libSDL2-2.0.0.dylib</key>
|
||||
<dict>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
0hFn0ajnZSU71+kD2arQPc5LYrEuOwhg3yoXVqpdiYw=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Resources/icons/AppIconLarge.png</key>
|
||||
<dict>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
iFTMCBCpukKtzwrvTkmN9uB1iSTNt2y5aTSfBqsVaQ4=
|
||||
</data>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>rules</key>
|
||||
<dict>
|
||||
<key>^Resources/</key>
|
||||
<true/>
|
||||
<key>^Resources/.*\.lproj/</key>
|
||||
<dict>
|
||||
<key>optional</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>1000</real>
|
||||
</dict>
|
||||
<key>^Resources/.*\.lproj/locversion.plist$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>1100</real>
|
||||
</dict>
|
||||
<key>^Resources/Base\.lproj/</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>1010</real>
|
||||
</dict>
|
||||
<key>^version.plist$</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>rules2</key>
|
||||
<dict>
|
||||
<key>.*\.dSYM($|/)</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>11</real>
|
||||
</dict>
|
||||
<key>^(.*/)?\.DS_Store$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>2000</real>
|
||||
</dict>
|
||||
<key>^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/</key>
|
||||
<dict>
|
||||
<key>nested</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>10</real>
|
||||
</dict>
|
||||
<key>^.*</key>
|
||||
<true/>
|
||||
<key>^Info\.plist$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
<key>^PkgInfo$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
<key>^Resources/</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
<key>^Resources/.*\.lproj/</key>
|
||||
<dict>
|
||||
<key>optional</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>1000</real>
|
||||
</dict>
|
||||
<key>^Resources/.*\.lproj/locversion.plist$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>1100</real>
|
||||
</dict>
|
||||
<key>^Resources/Base\.lproj/</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>1010</real>
|
||||
</dict>
|
||||
<key>^[^/]+$</key>
|
||||
<dict>
|
||||
<key>nested</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>10</real>
|
||||
</dict>
|
||||
<key>^embedded\.provisionprofile$</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
<key>^version\.plist$</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
+27
-7
@@ -4,6 +4,7 @@ using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.Storage;
|
||||
using SDL2;
|
||||
|
||||
namespace ARMSX
|
||||
@@ -119,15 +120,25 @@ namespace ARMSX
|
||||
|
||||
private static string BuildNativeLogPath()
|
||||
{
|
||||
string prefPath = SDL.SDL_GetPrefPath("nanodata", "armsx");
|
||||
if (string.IsNullOrEmpty(prefPath))
|
||||
try
|
||||
{
|
||||
string localStatePath = ApplicationData.Current?.LocalFolder?.Path;
|
||||
if (string.IsNullOrEmpty(localStatePath))
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
string prefPath = Path.Combine(localStatePath, "nanodata", "armsx");
|
||||
string logDirectory = Path.Combine(prefPath, "logs");
|
||||
Directory.CreateDirectory(logDirectory);
|
||||
return Path.Combine(logDirectory, "armsx-uwp.log");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
OutputDebugStringW($"ARMSX UWP host log path init failed: {ex}{Environment.NewLine}");
|
||||
Debug.WriteLine($"ARMSX UWP host log path init failed: {ex}");
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
string logDirectory = Path.Combine(prefPath, "logs");
|
||||
Directory.CreateDirectory(logDirectory);
|
||||
return Path.Combine(logDirectory, "armsx-uwp.log");
|
||||
}
|
||||
|
||||
private static void LogManagedException(string source, Exception exception)
|
||||
@@ -154,7 +165,16 @@ namespace ARMSX
|
||||
|
||||
lock (logLock)
|
||||
{
|
||||
File.AppendAllText(nativeLogPath, line + Environment.NewLine, Encoding.UTF8);
|
||||
try
|
||||
{
|
||||
File.AppendAllText(nativeLogPath, line + Environment.NewLine, Encoding.UTF8);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
OutputDebugStringW($"ARMSX UWP host file logging disabled: {ex}{Environment.NewLine}");
|
||||
Debug.WriteLine($"ARMSX UWP host file logging disabled: {ex}");
|
||||
nativeLogPath = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
Debug.WriteLine(line);
|
||||
|
||||
Reference in New Issue
Block a user