@@ -110,6 +110,32 @@ const getRegisteredHandler = <T extends (...args: never[]) => unknown>(
110
110
return handler as unknown as HandlerType < T > ;
111
111
} ;
112
112
113
+ type ElectronPathName =
114
+ | 'home'
115
+ | 'appData'
116
+ | 'userData'
117
+ | 'sessionData'
118
+ | 'temp'
119
+ | 'exe'
120
+ | 'module'
121
+ | 'desktop'
122
+ | 'documents'
123
+ | 'downloads'
124
+ | 'music'
125
+ | 'pictures'
126
+ | 'videos'
127
+ | 'recent'
128
+ | 'logs'
129
+ | 'crashDumps' ;
130
+
131
+ const mockPaths = ( overrides : Partial < Record < ElectronPathName , string > > = { } ) => {
132
+ vi . mocked ( app . getPath ) . mockImplementation ( ( name : ElectronPathName ) : string => {
133
+ if ( name in overrides ) return overrides [ name ] ! ;
134
+ if ( name in MOCK_PATHS ) return MOCK_PATHS [ name as keyof typeof MOCK_PATHS ] ;
135
+ return path . normalize ( `/mock/${ name } ` ) ;
136
+ } ) ;
137
+ } ;
138
+
113
139
describe ( 'PathHandlers' , ( ) => {
114
140
beforeEach ( ( ) => {
115
141
vi . mocked ( app . getPath ) . mockImplementation (
@@ -328,6 +354,19 @@ describe('PathHandlers', () => {
328
354
defaultInstallPath : path . join ( '/mock/documents' , 'ComfyUI' ) ,
329
355
} ) ;
330
356
} ) ;
357
+
358
+ it ( 'Windows: should remove OneDrive from documents path' , async ( ) => {
359
+ // Mock Windows platform
360
+ const restorePlatform = mockProcessPlatform ( 'win32' ) ;
361
+ mockPaths ( { documents : String . raw `C:\Users\Test\OneDrive\Documents` } ) ;
362
+
363
+ const result = await getSystemPathsHandler ( { } ) ;
364
+ const expected = String . raw `C:\Users\Test\Documents\ComfyUI` ;
365
+ expect ( result . defaultInstallPath ) . toBe ( expected ) ;
366
+
367
+ // Restore original platform
368
+ restorePlatform ( ) ;
369
+ } ) ;
331
370
} ) ;
332
371
333
372
describe ( 'validate-comfyui-source' , ( ) => {
0 commit comments