forked from arduino/arduino-ide
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes arduino#1501 Upstream: eclipse-theia/theia#12354 Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
- Loading branch information
Akos Kitta
committed
Apr 20, 2023
1 parent
1142296
commit e4fc3cf
Showing
5 changed files
with
40 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
arduino-ide-extension/src/node/theia/filesystem/disk-file-system-provider.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import URI from '@theia/core/lib/common/uri'; | ||
import { injectable } from '@theia/core/shared/inversify'; | ||
import { FilePermission, Stat } from '@theia/filesystem/lib/common/files'; | ||
import { DiskFileSystemProvider as TheiaDiskFileSystemProvider } from '@theia/filesystem/lib/node/disk-file-system-provider'; | ||
import { Mode } from 'stat-mode'; | ||
|
||
@injectable() | ||
export class DiskFileSystemProvider extends TheiaDiskFileSystemProvider { | ||
override async stat(resource: URI): Promise<Stat> { | ||
try { | ||
const { stat, symbolicLink } = await this.statLink( | ||
this.toFilePath(resource) | ||
); // cannot use fs.stat() here to support links properly | ||
const mode = new Mode(stat); | ||
return { | ||
type: this['toType'](stat, symbolicLink), | ||
ctime: stat.birthtime.getTime(), // intentionally not using ctime here, we want the creation time | ||
mtime: stat.mtime.getTime(), | ||
size: stat.size, | ||
permissions: !mode.owner.write ? FilePermission.Readonly : undefined, // Customized for https://github.com/eclipse-theia/theia/pull/12354 | ||
}; | ||
} catch (error) { | ||
throw this['toFileSystemProviderError'](error); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters