@@ -82,16 +82,15 @@ public static bool IsPending()
8282
8383 /// <summary>
8484 /// Returns GVFS.Mount processes whose executable is in the install
85- /// directory. Processes from dev builds or other installs are excluded
86- /// so they don't block upgrades of the system install. If a process's
87- /// path cannot be read (access denied, 32/64-bit mismatch), it is
88- /// included conservatively.
85+ /// directory (or any versioned subdirectory) . Processes from dev builds
86+ /// or other installs are excluded so they don't block upgrades of the
87+ /// system install. If a process's path cannot be read (access denied,
88+ /// 32/64-bit mismatch), it is included conservatively.
8989 /// Caller must dispose the returned Process objects.
9090 /// </summary>
9191 public static List < Process > GetInstalledMountProcesses ( ITracer tracer )
9292 {
9393 string installDir = Configuration . AssemblyPath ;
94- string expectedPath = Path . Combine ( installDir , MountExeName ) ;
9594 Process [ ] allMountProcesses = Process . GetProcessesByName ( MountProcessName ) ;
9695 List < Process > installed = new List < Process > ( ) ;
9796
@@ -101,8 +100,7 @@ public static List<Process> GetInstalledMountProcesses(ITracer tracer)
101100 try
102101 {
103102 string processPath = process . MainModule ? . FileName ;
104- if ( processPath != null &&
105- ! PathComparer . Equals ( processPath , expectedPath ) )
103+ if ( processPath != null && ! IsInstalledMountPath ( installDir , processPath ) )
106104 {
107105 include = false ;
108106 tracer . RelatedInfo (
@@ -326,6 +324,26 @@ private static bool IsMarkerFile(string relativePath)
326324 string . Equals ( relativePath , Phase1CompleteMarkerFileName , StringComparison . OrdinalIgnoreCase ) ;
327325 }
328326
327+ /// <summary>
328+ /// Returns true if the given GVFS.Mount.exe path is under the install
329+ /// directory — either in the flat layout (<c>{app}\GVFS.Mount.exe</c>)
330+ /// or in a versioned subdirectory (<c>{app}\Versions\*\GVFS.Mount.exe</c>
331+ /// or <c>{app}\Current\GVFS.Mount.exe</c>).
332+ /// </summary>
333+ private static bool IsInstalledMountPath ( string installDir , string processPath )
334+ {
335+ // Verify filename is actually GVFS.Mount.exe (not some other exe
336+ // under the install dir).
337+ if ( ! PathComparer . Equals ( Path . GetFileName ( processPath ) , MountExeName ) )
338+ {
339+ return false ;
340+ }
341+
342+ // Verify the exe lives under the install directory.
343+ string normalizedInstallDir = installDir . TrimEnd ( Path . DirectorySeparatorChar ) + Path . DirectorySeparatorChar ;
344+ return processPath . StartsWith ( normalizedInstallDir , StringComparison . OrdinalIgnoreCase ) ;
345+ }
346+
329347 /// <summary>
330348 /// Moves a file, retrying once after killing any process that has the
331349 /// source file locked (e.g. a GVFS process that started mid-upgrade).
0 commit comments