@@ -103,19 +103,25 @@ await FilesystemTasks.Wrap(() => StorageFile.GetFileFromPathAsync(Path.Combine(a
103103 } ;
104104 }
105105
106+ // Log the contents of the root_preferences database to the debug output.
106107 await Inspect ( database , "SELECT * FROM roots" , "root_preferences db, roots table" ) ;
107108 await Inspect ( database , "SELECT * FROM media" , "root_preferences db, media table" ) ;
108109 await Inspect ( database , "SELECT name FROM sqlite_master WHERE type = 'table' ORDER BY 1" , "root_preferences db, all tables" ) ;
109110
110- var registryPath = App . AppModel . GoogleDrivePath ;
111- if ( registryPath . Equals ( string . Empty ) )
112- yield break ;
113- yield return new CloudProvider ( CloudProviders . GoogleDrive )
114- {
115- Name = "Google Drive" ,
116- SyncFolder = registryPath ,
117- IconData = iconFile is not null ? await iconFile . ToByteArrayAsync ( ) : null
118- } ;
111+ // Query the Windows Registry for the base Google Drive path and time the query.
112+ var sw = Stopwatch . StartNew ( ) ;
113+ var googleDrivePath = GetRegistryBasePath ( ) ?? string . Empty ;
114+ sw . Stop ( ) ;
115+ Debug . WriteLine ( $ "Google Drive path registry check took { sw . Elapsed } seconds.") ;
116+
117+ // Add "My Drive" to the base GD path and return the resulting cloud provider.
118+ if ( AddMyDriveToPathAndValidate ( ref googleDrivePath ) )
119+ yield return new CloudProvider ( CloudProviders . GoogleDrive )
120+ {
121+ Name = "Google Drive" ,
122+ SyncFolder = googleDrivePath ,
123+ IconData = iconFile is not null ? await iconFile . ToByteArrayAsync ( ) : null
124+ } ;
119125 }
120126
121127 private static async Task Inspect ( SqliteConnection database , string sqlCommand , string targetDescription )
@@ -175,8 +181,8 @@ private static async Task Inspect(SqliteConnection database, string sqlCommand,
175181 . RootElement . EnumerateObject ( )
176182 . FirstOrDefault ( ) ;
177183
178- // A default JsonProperty struct has an " Undefined" Value# ValueKind and throws an
179- // error if you try to call EnumerateArray on its Value.
184+ // A default ` JsonProperty` struct has an Undefined ` Value. ValueKind` and throws an
185+ // error if you try to call ` EnumerateArray` on its ` Value` .
180186 if ( googleDriveRegValJsonProperty . Value . ValueKind == JsonValueKind . Undefined )
181187 {
182188 _logger . LogWarning ( $ "Root element of Google Drive registry value for value name '{ _googleDriveRegValName } ' was empty.") ;
@@ -269,7 +275,8 @@ public static bool AddMyDriveToPathAndValidate(ref string path)
269275 si . Name ? . Equals ( "My Drive" ) ?? false ) as ShellLink ) ? . TargetPath
270276 ?? string . Empty ) ;
271277
272- Debug . WriteLine ( "SHELL FOLDER LOGGING" ) ;
278+ var callingMethod = new StackFrame ( 1 ) . GetMethod ( ) ;
279+ Debug . WriteLine ( $ "SHELL FOLDER LOGGING (Context: `{ callingMethod ? . Name } ` in `{ callingMethod ? . DeclaringType } `)") ;
273280 rootFolder ? . ForEach ( si => Debug . WriteLine ( si . Name ) ) ;
274281
275282 if ( ! string . IsNullOrEmpty ( myDriveFolder ) )
0 commit comments