Skip to content

Commit 29c595b

Browse files
committed
Remove MigrationCleanup scheduled task entirely
With force-unmount + synchronous DelTree, the deferred cleanup task is unnecessary. If DelTree can't delete some files (rare — process has a handle open), the leftover files are inert: no service, no PATH entry, no mounts reference them. Not worth the complexity of a SYSTEM-context scheduled task. Removes: - gvfs-migration-cleanup.ps1 (script source) - gvfs-migration-cleanup-task.xml.template (task XML template) - BuildCleanupTaskXml MSBuild target + CleanupScriptsDir property - CleanupTaskXml [Files] entry and /D define in ISCC invocation - Fallback task registration in MigrateLegacyInstall() Assisted-by: Claude Opus 4.6 Signed-off-by: Tyrie Vella <tyrielv@gmail.com>
1 parent 1ad6f2f commit 29c595b

4 files changed

Lines changed: 4 additions & 256 deletions

File tree

‎GVFS/GVFS.Installers/GVFS.Installers.csproj‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
<LayoutPath>$(RepoOutPath)GVFS.Payload\bin\$(Configuration)\win-x64\</LayoutPath>
66
<ProjFSAttachScriptsDir>$(MSBuildThisFileDirectory)..\..\scripts\projfs-attach\</ProjFSAttachScriptsDir>
77
<ProjFSTaskXmlPath>$(IntermediateOutputPath)enable-projfs-on-all-drives-task.xml</ProjFSTaskXmlPath>
8-
<CleanupScriptsDir>$(MSBuildThisFileDirectory)..\..\scripts\cleanup\</CleanupScriptsDir>
9-
<CleanupTaskXmlPath>$(IntermediateOutputPath)gvfs-migration-cleanup-task.xml</CleanupTaskXmlPath>
108
</PropertyGroup>
119

1210
<ItemDefinitionGroup>
@@ -32,12 +30,8 @@
3230
<Exec Command='powershell.exe -NoProfile -ExecutionPolicy Bypass -File "$(ProjFSAttachScriptsDir)build-task-xml.ps1" -ScriptPath "$(ProjFSAttachScriptsDir)enable-projfs-on-all-drives.ps1" -TemplatePath "$(ProjFSAttachScriptsDir)enable-projfs-on-all-drives-task.xml.template" -OutputPath "$(ProjFSTaskXmlPath)"' />
3331
</Target>
3432

35-
<Target Name="BuildCleanupTaskXml" BeforeTargets="CreateInstaller" Condition="'$(SkipCreateInstaller)' != 'true'">
36-
<Exec Command='powershell.exe -NoProfile -ExecutionPolicy Bypass -File "$(ProjFSAttachScriptsDir)build-task-xml.ps1" -ScriptPath "$(CleanupScriptsDir)gvfs-migration-cleanup.ps1" -TemplatePath "$(CleanupScriptsDir)gvfs-migration-cleanup-task.xml.template" -OutputPath "$(CleanupTaskXmlPath)"' />
37-
</Target>
38-
3933
<Target Name="CreateInstaller" BeforeTargets="Build" Condition="'$(SkipCreateInstaller)' != 'true'">
40-
<Exec Command='"$(PkgTools_InnoSetup)\tools\ISCC.exe" /DLayoutDir="$(LayoutPath)" /DGVFSVersion=$(GVFSVersion) /DProjFSTaskXml="$(ProjFSTaskXmlPath)" /DCleanupTaskXml="$(CleanupTaskXmlPath)" Setup.iss /O"$(OutputPath)"' />
34+
<Exec Command='"$(PkgTools_InnoSetup)\tools\ISCC.exe" /DLayoutDir="$(LayoutPath)" /DGVFSVersion=$(GVFSVersion) /DProjFSTaskXml="$(ProjFSTaskXmlPath)" Setup.iss /O"$(OutputPath)"' />
4135
</Target>
4236

4337
<Target Name="CleanInstaller" BeforeTargets="AfterClean">

‎GVFS/GVFS.Installers/Setup.iss‎

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,6 @@ DestDir: "{localappdata}\GVFS\Versions\{#GVFSVersion}"; Flags: ignoreversion rec
8181
#ifdef ProjFSTaskXml
8282
Source: "{#ProjFSTaskXml}"; Flags: dontcopy
8383
#endif
84-
#ifdef CleanupTaskXml
85-
Source: "{#CleanupTaskXml}"; Flags: dontcopy
86-
#endif
8784

8885
[Dirs]
8986
Name: "{app}\ProgramData\{#ServiceName}"; Permissions: users-readexec; Check: IsSystemModeInstall
@@ -1308,21 +1305,11 @@ begin
13081305
13091306
// 6. Delete the legacy install directory synchronously.
13101307
// Since we force-unmounted all repos above, no mount processes
1311-
// should be holding files open. If deletion fails for some files,
1312-
// register the cleanup task as a fallback.
1308+
// should be holding files open. Any leftover files are inert
1309+
// (no service, no PATH, no mounts) — just wasted disk space.
13131310
Log('MigrateLegacyInstall: Deleting legacy install directory ' + LegacyDir);
13141311
if not DelTree(LegacyDir, True, True, True) then
1315-
begin
1316-
Log('MigrateLegacyInstall: Warning - could not fully delete ' + LegacyDir + ', registering cleanup task as fallback');
1317-
ExtractTemporaryFile('gvfs-migration-cleanup-task.xml');
1318-
if not Exec(ExpandConstant('{sys}\schtasks.exe'), '/Create /TN "\GVFS\MigrationCleanup" /XML "' + ExpandConstant('{tmp}\gvfs-migration-cleanup-task.xml') + '" /F', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) or (ResultCode <> 0) then
1319-
Log('MigrateLegacyInstall: Warning - could not register cleanup task (exit ' + IntToStr(ResultCode) + ')')
1320-
else
1321-
begin
1322-
Log('MigrateLegacyInstall: Cleanup task registered as fallback');
1323-
Exec(ExpandConstant('{sys}\schtasks.exe'), '/Run /TN "\GVFS\MigrationCleanup"', '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
1324-
end;
1325-
end
1312+
Log('MigrateLegacyInstall: Warning - could not fully delete ' + LegacyDir + ' (leftover files are inert)')
13261313
else
13271314
Log('MigrateLegacyInstall: Legacy install directory deleted');
13281315

‎scripts/cleanup/gvfs-migration-cleanup-task.xml.template‎

Lines changed: 0 additions & 74 deletions
This file was deleted.

‎scripts/cleanup/gvfs-migration-cleanup.ps1‎

Lines changed: 0 additions & 159 deletions
This file was deleted.

0 commit comments

Comments
 (0)