Skip to content

Commit

Permalink
Record information about which files are wiped (#1997)
Browse files Browse the repository at this point in the history
  • Loading branch information
nagilson authored Oct 22, 2024
1 parent 2ff7c2a commit a2e6a5c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,14 @@ export class DuplicateInstallDetected extends DotnetCustomMessageEvent {
public readonly eventName = 'DuplicateInstallDetected';
}

export class EmptyDirectoryToWipe extends DotnetCustomMessageEvent {
public readonly eventName = 'EmptyDirectoryToWipe';
}

export class FileToWipe extends DotnetCustomMessageEvent {
public readonly eventName = 'FileToWipe';
}

export class TriedToExitMasterSudoProcess extends DotnetCustomMessageEvent {
public readonly eventName = 'TriedToExitMasterSudoProcess';
}
Expand Down
4 changes: 4 additions & 0 deletions vscode-dotnet-runtime-library/src/Utils/FileUtilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import { DotnetCommandFallbackArchitectureEvent,
DotnetLockAttemptingAcquireEvent,
DotnetLockErrorEvent,
DotnetLockReleasedEvent,
EmptyDirectoryToWipe,
FileToWipe,
SuppressedAcquisitionError
} from '../EventStream/EventStreamEvents';

Expand Down Expand Up @@ -105,6 +107,7 @@ export class FileUtilities extends IFileUtilities
{
if(!fs.existsSync(directoryToWipe))
{
eventStream?.post(new EmptyDirectoryToWipe(`The directory ${directoryToWipe} did not exist, so it was not wiped.`))
return;
}

Expand All @@ -113,6 +116,7 @@ export class FileUtilities extends IFileUtilities
{
try
{
eventStream?.post(new FileToWipe(`The file ${f} is being deleted.`))
if(!fileExtensionsToDelete || path.extname(f).toLocaleLowerCase() in fileExtensionsToDelete)
fs.rmSync(path.join(directoryToWipe, f));
}
Expand Down

0 comments on commit a2e6a5c

Please sign in to comment.