@@ -65,11 +65,11 @@ internal async Task<string> RestoreBackup(int gameId, string installationDir)
6565
6666 try
6767 {
68-
68+
6969 string installationId = GetGameInstallationId ( installationDir ) ;
7070 string [ ] auth = WebHelper . GetCredentials ( ) ;
71-
72- string url = @$ "{ SettingsViewModel . Instance . ServerUrl } /api/savefiles/user/{ LoginManager . Instance . GetCurrentUser ( ) ! . ID } /game/{ gameId } ";
71+
72+ string url = @$ "{ SettingsViewModel . Instance . ServerUrl } /api/savefiles/user/{ LoginManager . Instance . GetCurrentUser ( ) ! . ID } /game/{ gameId } ";
7373 using ( HttpResponseMessage response = await WebHelper . GetAsync ( @$ "{ SettingsViewModel . Instance . ServerUrl } /api/savefiles/user/{ LoginManager . Instance . GetCurrentUser ( ) ! . ID } /game/{ gameId } ", HttpCompletionOption . ResponseHeadersRead ) )
7474 {
7575 response . EnsureSuccessStatusCode ( ) ;
@@ -215,57 +215,64 @@ internal async Task<string> BackupSaveGame(int gameId)
215215 public void PrepareConfigFile ( string installationPath , string yamlPath )
216216 {
217217 string userFolder = Environment . GetFolderPath ( Environment . SpecialFolder . UserProfile ) ;
218- var redirects = new Dictionary < string , object >
218+
219+ // Base configuration with redirects (always included)
220+ var redirects = new List < Dictionary < string , object > >
221+ {
222+ new Dictionary < string , object >
219223 {
220- { "redirects" , new List < Dictionary < string , object > >
221- {
222- new Dictionary < string , object >
223- {
224- { "kind" , "bidirectional" } ,
225- { "source" , userFolder } ,
226- { "target" , "G:\\ gamevault\\ currentuser" }
227- } ,
228- new Dictionary < string , object >
229- {
230- { "kind" , "bidirectional" } ,
231- { "source" , installationPath } ,
232- { "target" , "G:\\ gamevault\\ installation" }
233- }
234- }
224+ { "kind" , "bidirectional" } ,
225+ { "source" , userFolder } ,
226+ { "target" , "G:\\ gamevault\\ currentuser" }
227+ } ,
228+ new Dictionary < string , object >
229+ {
230+ { "kind" , "bidirectional" } ,
231+ { "source" , installationPath } ,
232+ { "target" , "G:\\ gamevault\\ installation" }
233+ }
234+ } ;
235+
236+
237+
238+ var roots = new List < Dictionary < string , object > > ( ) ;
239+ foreach ( DirectoryEntry rootPath in SettingsViewModel . Instance . RootDirectories )
240+ {
241+ roots . Add ( new Dictionary < string , object >
242+ {
243+ { "store" , "other" } ,
244+ { "path" , Path . Combine ( rootPath . Uri , "GameVault" , "Installations" ) }
245+ } ) ;
235246 }
236- } ;
237247
238- // Simulating SettingsViewModel.Instance.CustomCloudSaveManifests
239- var customLudusaviManifests = SettingsViewModel . Instance . CustomCloudSaveManifests . Where ( m => ! string . IsNullOrWhiteSpace ( m . Uri ) ) ;
248+ // Start with base configuration (redirects and roots always included)
249+ var yamlData = new Dictionary < string , object >
250+ {
251+ { "redirects" , redirects } ,
252+ { "roots" , roots }
253+ } ;
240254
241- Dictionary < string , object > yamlData ;
255+ // Add manifest section if custom manifests exist (optional)
256+ var customLudusaviManifests = SettingsViewModel . Instance . CustomCloudSaveManifests . Where ( m => ! string . IsNullOrWhiteSpace ( m . Uri ) ) ;
242257
243- if ( customLudusaviManifests . Any ( ) ) // If manifests exist, merge with redirects
258+ if ( customLudusaviManifests . Any ( ) )
244259 {
245260 var manifest = new Dictionary < string , object >
246- {
247- { "enable" , SettingsViewModel . Instance . UsePrimaryCloudSaveManifest } ,
248- { "secondary" , new List < Dictionary < string , object > > ( ) }
249- } ;
261+ {
262+ { "enable" , SettingsViewModel . Instance . UsePrimaryCloudSaveManifest } ,
263+ { "secondary" , new List < Dictionary < string , object > > ( ) }
264+ } ;
250265
251266 foreach ( DirectoryEntry entry in customLudusaviManifests )
252267 {
253268 ( ( List < Dictionary < string , object > > ) manifest [ "secondary" ] ) . Add ( new Dictionary < string , object >
254- {
255- { Uri . IsWellFormedUriString ( entry . Uri , UriKind . Absolute ) ? "url" : "path" , entry . Uri } ,
256- { "enable" , true }
257- } ) ;
269+ {
270+ { Uri . IsWellFormedUriString ( entry . Uri , UriKind . Absolute ) ? "url" : "path" , entry . Uri } ,
271+ { "enable" , true }
272+ } ) ;
258273 }
259274
260- yamlData = new Dictionary < string , object >
261- {
262- { "manifest" , manifest } ,
263- { "redirects" , redirects [ "redirects" ] } // Merge redirects
264- } ;
265- }
266- else
267- {
268- yamlData = redirects ; // Only redirects if no manifests
275+ yamlData . Add ( "manifest" , manifest ) ;
269276 }
270277
271278 var serializer = new SerializerBuilder ( )
@@ -275,6 +282,7 @@ public void PrepareConfigFile(string installationPath, string yamlPath)
275282 string result = serializer . Serialize ( yamlData ) ;
276283 File . WriteAllText ( yamlPath , result ) ;
277284 }
285+
278286 internal async Task < string > SearchForLudusaviGameTitle ( string title )
279287 {
280288 return await Task . Run < string > ( ( ) =>
0 commit comments