Skip to content

Commit

Permalink
Use systeminformation to replace check-disk-space
Browse files Browse the repository at this point in the history
  • Loading branch information
huchenlei committed Nov 13, 2024
1 parent bc4bd2b commit 6de3afc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@
"@todesktop/runtime": "^1.6.4",
"adm-zip": "^0.5.15",
"axios": "^1.7.7",
"check-disk-space": "^3.4.0",
"dotenv": "^16.4.5",
"electron-log": "^5.2.0",
"electron-store": "8.2.0",
Expand Down
7 changes: 4 additions & 3 deletions src/handlers/pathHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { getModelConfigPath } from '../config/extra_model_config';
import { getBasePath } from '../install/resourcePaths';
import type { SystemPaths } from '../preload';
import fs from 'fs';
import checkDiskSpace from 'check-disk-space';
import si from 'systeminformation';
import { ComfyConfigManager } from '../config/comfyConfigManager';

export class PathHandlers {
Expand Down Expand Up @@ -60,8 +60,9 @@ export class PathHandlers {
}

// Check available disk space (require at least 10GB free)
const space = await checkDiskSpace(path);
if (space.free < PathHandlers.REQUIRED_SPACE) {
const disks = await si.fsSize();
const disk = disks.find((disk) => path.startsWith(disk.mount));
if (disk && disk.available < PathHandlers.REQUIRED_SPACE) {
return {
isValid: false,
error: 'Insufficient disk space. At least 10GB of free space is required.',
Expand Down
8 changes: 0 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,6 @@ __metadata:
"@typescript-eslint/parser": "npm:^5.0.0"
adm-zip: "npm:^0.5.15"
axios: "npm:^1.7.7"
check-disk-space: "npm:^3.4.0"
dotenv: "npm:^16.4.5"
electron: "npm:31.3.1"
electron-builder: "npm:^25.1.8"
Expand Down Expand Up @@ -4935,13 +4934,6 @@ __metadata:
languageName: node
linkType: hard

"check-disk-space@npm:^3.4.0":
version: 3.4.0
resolution: "check-disk-space@npm:3.4.0"
checksum: 10c0/cc39c91e1337e974fb5069c2fbd9eb92aceca6e35f3da6863a4eada58f15c1bf6970055bffed1e41c15cde1fd0ad2580bb99bef8275791ed56d69947f8657aa5
languageName: node
linkType: hard

"chokidar@npm:^3.5.3":
version: 3.6.0
resolution: "chokidar@npm:3.6.0"
Expand Down

0 comments on commit 6de3afc

Please sign in to comment.