@@ -14,7 +14,7 @@ public static async Task RunAsync(string app, string appId, string gameName, boo
1414 var startInfo = new ProcessStartInfo
1515 {
1616 WindowStyle = ProcessWindowStyle . Hidden ,
17- FileName = $ "{ dir } { app } ",
17+ FileName = $ "{ dir } / { app } ",
1818 Arguments = arguments ,
1919 CreateNoWindow = true ,
2020 UseShellExecute = false ,
@@ -50,31 +50,29 @@ public static async Task RunAsync(string app, string appId, string gameName, boo
5050 private static string Clone ( string appId )
5151 {
5252 var current = Directory . GetCurrentDirectory ( ) ;
53- var dir = $ "{ current } /Apps/{ appId } /";
54- if ( Directory . Exists ( dir ) )
55- Directory . Delete ( dir , true ) ;
56- Directory . CreateDirectory ( dir ) ;
57- Directory . CreateDirectory ( $ "{ dir } runtimes") ;
53+ var targetRoot = Path . Combine ( current , "Apps" , appId ) ;
5854
59- var files = Directory . EnumerateFiles ( current ) . Where ( x =>
60- Path . GetFileNameWithoutExtension ( x ) . Contains ( "SteamAchievementUnlockerAgent" ) ||
61- Path . GetExtension ( x ) . Contains ( ".dll" ) ||
62- Path . GetExtension ( x ) . Contains ( ".json" ) ) ;
55+ if ( Directory . Exists ( targetRoot ) )
56+ Directory . Delete ( targetRoot , true ) ;
57+ Directory . CreateDirectory ( targetRoot ) ;
6358
64- var runtimes = Directory . EnumerateFiles ( $ "{ current } /runtimes", "*.*" , new EnumerationOptions { RecurseSubdirectories = true } ) ;
65-
66- foreach ( var file in runtimes )
67- {
68- var directory = file . Replace ( Path . GetFileName ( file ) , string . Empty ) . Replace ( "runtimes" , $ "Apps/{ appId } /runtimes") ;
69- Directory . CreateDirectory ( $ "{ directory } ") ;
70- File . CreateSymbolicLink ( $ "{ directory } /{ Path . GetFileName ( file ) } ", file ) ;
71- }
59+ var files = Directory . EnumerateFiles ( current , "*" , SearchOption . AllDirectories )
60+ . Where ( x => ! x . Contains ( "Apps" ) &&
61+ ! x . Contains ( "Logs" ) &&
62+ ! ( x . Contains ( "SteamAchievementUnlocker" ) && ! x . Contains ( "SteamAchievementUnlockerAgent" ) ) ) ;
7263
7364 foreach ( var file in files )
7465 {
75- File . CreateSymbolicLink ( $ "{ dir } { Path . GetFileName ( file ) } ", file ) ;
66+ var relativePath = Path . GetRelativePath ( current , file ) ;
67+ var targetPath = Path . Combine ( targetRoot , relativePath ) ;
68+ var targetDir = Path . GetDirectoryName ( targetPath ) ;
69+
70+ if ( ! Directory . Exists ( targetDir ) )
71+ Directory . CreateDirectory ( targetDir ! ) ;
72+
73+ File . CreateSymbolicLink ( targetPath , file ) ;
7674 }
7775
78- return dir ;
76+ return targetRoot ;
7977 }
8078}
0 commit comments