Files
privacy.sexy/tests/unit/shared/Stubs/RuntimeEnvironmentStub.ts
undergroundwires 40f5eb8334 Fix handling special chars in script paths
This commit improves the handling of paths with spaces or special
characters during script execution in the desktop application.

Key improvements:

- Paths are now quoted for macOS/Linux, addressing issues with
  whitespace or single quotes.
- Windows paths are enclosed in double quotes to handle special
  characters.

Other supporting changes:

- Add more documentation for terminal execution commands.
- Refactor terminal script file execution into a dedicated file for
  improved separation of concerns.
- Refactor naming of `RuntimeEnvironment` to align with naming
  conventions (no interface with I prefix) and for clarity.
- Refactor `TemporaryFileCodeRunner` to simplify it by removing the `os`
  parameter and handling OS-specific logic within the filename generator
  instead.
- Refactor `fileName` to `filename` for consistency.
2024-01-02 16:16:31 +01:00

26 lines
685 B
TypeScript

import { RuntimeEnvironment } from '@/infrastructure/RuntimeEnvironment/RuntimeEnvironment';
import { OperatingSystem } from '@/domain/OperatingSystem';
export class RuntimeEnvironmentStub implements RuntimeEnvironment {
public isNonProduction = true;
public isDesktop = true;
public os: OperatingSystem | undefined = OperatingSystem.Windows;
public withOs(os: OperatingSystem | undefined): this {
this.os = os;
return this;
}
public withIsDesktop(isDesktop: boolean): this {
this.isDesktop = isDesktop;
return this;
}
public withIsNonProduction(isNonProduction: boolean): this {
this.isNonProduction = isNonProduction;
return this;
}
}