@theia/filesystem 1.77.0-next.95 → 1.77.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/browser/breadcrumbs/filepath-breadcrumb.js +4 -8
- package/lib/browser/breadcrumbs/filepath-breadcrumb.js.map +1 -1
- package/lib/browser/breadcrumbs/filepath-breadcrumbs-container.d.ts +1 -1
- package/lib/browser/breadcrumbs/filepath-breadcrumbs-container.d.ts.map +1 -1
- package/lib/browser/breadcrumbs/filepath-breadcrumbs-container.js +18 -25
- package/lib/browser/breadcrumbs/filepath-breadcrumbs-container.js.map +1 -1
- package/lib/browser/breadcrumbs/filepath-breadcrumbs-contribution.d.ts +5 -5
- package/lib/browser/breadcrumbs/filepath-breadcrumbs-contribution.d.ts.map +1 -1
- package/lib/browser/breadcrumbs/filepath-breadcrumbs-contribution.js +27 -33
- package/lib/browser/breadcrumbs/filepath-breadcrumbs-contribution.js.map +1 -1
- package/lib/browser/download/file-download-command-contribution.d.ts +1 -1
- package/lib/browser/download/file-download-command-contribution.d.ts.map +1 -1
- package/lib/browser/download/file-download-command-contribution.js +28 -33
- package/lib/browser/download/file-download-command-contribution.js.map +1 -1
- package/lib/browser/download/file-download-frontend-module.js +8 -10
- package/lib/browser/download/file-download-frontend-module.js.map +1 -1
- package/lib/browser/download/file-download-service.d.ts +1 -1
- package/lib/browser/download/file-download-service.d.ts.map +1 -1
- package/lib/browser/download/file-download-service.js +19 -24
- package/lib/browser/download/file-download-service.js.map +1 -1
- package/lib/browser/file-dialog/file-dialog-container.d.ts +1 -1
- package/lib/browser/file-dialog/file-dialog-container.d.ts.map +1 -1
- package/lib/browser/file-dialog/file-dialog-container.js +25 -30
- package/lib/browser/file-dialog/file-dialog-container.js.map +1 -1
- package/lib/browser/file-dialog/file-dialog-hidden-files-renderer.d.ts +1 -1
- package/lib/browser/file-dialog/file-dialog-hidden-files-renderer.d.ts.map +1 -1
- package/lib/browser/file-dialog/file-dialog-hidden-files-renderer.js +13 -21
- package/lib/browser/file-dialog/file-dialog-hidden-files-renderer.js.map +1 -1
- package/lib/browser/file-dialog/file-dialog-model.d.ts +2 -2
- package/lib/browser/file-dialog/file-dialog-model.d.ts.map +1 -1
- package/lib/browser/file-dialog/file-dialog-model.js +20 -27
- package/lib/browser/file-dialog/file-dialog-model.js.map +1 -1
- package/lib/browser/file-dialog/file-dialog-module.js +21 -23
- package/lib/browser/file-dialog/file-dialog-module.js.map +1 -1
- package/lib/browser/file-dialog/file-dialog-service.d.ts +4 -4
- package/lib/browser/file-dialog/file-dialog-service.d.ts.map +1 -1
- package/lib/browser/file-dialog/file-dialog-service.js +29 -38
- package/lib/browser/file-dialog/file-dialog-service.js.map +1 -1
- package/lib/browser/file-dialog/file-dialog-tree-filters-renderer.d.ts +1 -1
- package/lib/browser/file-dialog/file-dialog-tree-filters-renderer.d.ts.map +1 -1
- package/lib/browser/file-dialog/file-dialog-tree-filters-renderer.js +16 -21
- package/lib/browser/file-dialog/file-dialog-tree-filters-renderer.js.map +1 -1
- package/lib/browser/file-dialog/file-dialog-tree-filters-renderer.spec.js +9 -11
- package/lib/browser/file-dialog/file-dialog-tree-filters-renderer.spec.js.map +1 -1
- package/lib/browser/file-dialog/file-dialog-tree.d.ts +2 -2
- package/lib/browser/file-dialog/file-dialog-tree.d.ts.map +1 -1
- package/lib/browser/file-dialog/file-dialog-tree.js +8 -11
- package/lib/browser/file-dialog/file-dialog-tree.js.map +1 -1
- package/lib/browser/file-dialog/file-dialog-widget.d.ts +2 -2
- package/lib/browser/file-dialog/file-dialog-widget.d.ts.map +1 -1
- package/lib/browser/file-dialog/file-dialog-widget.js +18 -23
- package/lib/browser/file-dialog/file-dialog-widget.js.map +1 -1
- package/lib/browser/file-dialog/file-dialog.d.ts +6 -6
- package/lib/browser/file-dialog/file-dialog.d.ts.map +1 -1
- package/lib/browser/file-dialog/file-dialog.js +114 -132
- package/lib/browser/file-dialog/file-dialog.js.map +1 -1
- package/lib/browser/file-dialog/index.d.ts +4 -4
- package/lib/browser/file-dialog/index.d.ts.map +1 -1
- package/lib/browser/file-dialog/index.js +4 -7
- package/lib/browser/file-dialog/index.js.map +1 -1
- package/lib/browser/file-resource.d.ts +2 -2
- package/lib/browser/file-resource.d.ts.map +1 -1
- package/lib/browser/file-resource.js +64 -71
- package/lib/browser/file-resource.js.map +1 -1
- package/lib/browser/file-resource.spec.js +39 -42
- package/lib/browser/file-resource.spec.js.map +1 -1
- package/lib/browser/file-selection.d.ts +1 -1
- package/lib/browser/file-selection.d.ts.map +1 -1
- package/lib/browser/file-selection.js +7 -10
- package/lib/browser/file-selection.js.map +1 -1
- package/lib/browser/file-service-activation.spec.js +14 -16
- package/lib/browser/file-service-activation.spec.js.map +1 -1
- package/lib/browser/file-service-copy.spec.js +44 -47
- package/lib/browser/file-service-copy.spec.js.map +1 -1
- package/lib/browser/file-service-watcher.spec.js +199 -202
- package/lib/browser/file-service-watcher.spec.js.map +1 -1
- package/lib/browser/file-service.d.ts +3 -3
- package/lib/browser/file-service.d.ts.map +1 -1
- package/lib/browser/file-service.js +166 -181
- package/lib/browser/file-service.js.map +1 -1
- package/lib/browser/file-tree/file-tree-container.js +12 -15
- package/lib/browser/file-tree/file-tree-container.js.map +1 -1
- package/lib/browser/file-tree/file-tree-decorator-adapter.js +23 -31
- package/lib/browser/file-tree/file-tree-decorator-adapter.js.map +1 -1
- package/lib/browser/file-tree/file-tree-decorator-adapter.spec.js +26 -29
- package/lib/browser/file-tree/file-tree-decorator-adapter.spec.js.map +1 -1
- package/lib/browser/file-tree/file-tree-label-provider.d.ts +1 -1
- package/lib/browser/file-tree/file-tree-label-provider.d.ts.map +1 -1
- package/lib/browser/file-tree/file-tree-label-provider.js +13 -18
- package/lib/browser/file-tree/file-tree-label-provider.js.map +1 -1
- package/lib/browser/file-tree/file-tree-model.d.ts +5 -5
- package/lib/browser/file-tree/file-tree-model.d.ts.map +1 -1
- package/lib/browser/file-tree/file-tree-model.js +48 -52
- package/lib/browser/file-tree/file-tree-model.js.map +1 -1
- package/lib/browser/file-tree/file-tree-widget.d.ts +3 -3
- package/lib/browser/file-tree/file-tree-widget.d.ts.map +1 -1
- package/lib/browser/file-tree/file-tree-widget.js +66 -72
- package/lib/browser/file-tree/file-tree-widget.js.map +1 -1
- package/lib/browser/file-tree/file-tree.d.ts +3 -3
- package/lib/browser/file-tree/file-tree.d.ts.map +1 -1
- package/lib/browser/file-tree/file-tree.js +26 -31
- package/lib/browser/file-tree/file-tree.js.map +1 -1
- package/lib/browser/file-tree/index.d.ts +6 -6
- package/lib/browser/file-tree/index.d.ts.map +1 -1
- package/lib/browser/file-tree/index.js +6 -9
- package/lib/browser/file-tree/index.js.map +1 -1
- package/lib/browser/filesystem-frontend-contribution.d.ts +6 -6
- package/lib/browser/filesystem-frontend-contribution.d.ts.map +1 -1
- package/lib/browser/filesystem-frontend-contribution.js +75 -90
- package/lib/browser/filesystem-frontend-contribution.js.map +1 -1
- package/lib/browser/filesystem-frontend-module.js +47 -50
- package/lib/browser/filesystem-frontend-module.js.map +1 -1
- package/lib/browser/filesystem-saveable-service.d.ts +2 -2
- package/lib/browser/filesystem-saveable-service.d.ts.map +1 -1
- package/lib/browser/filesystem-saveable-service.js +35 -44
- package/lib/browser/filesystem-saveable-service.js.map +1 -1
- package/lib/browser/filesystem-watcher-error-handler.js +13 -18
- package/lib/browser/filesystem-watcher-error-handler.js.map +1 -1
- package/lib/browser/index.d.ts +4 -4
- package/lib/browser/index.d.ts.map +1 -1
- package/lib/browser/index.js +4 -7
- package/lib/browser/index.js.map +1 -1
- package/lib/browser/location/index.d.ts +2 -2
- package/lib/browser/location/index.d.ts.map +1 -1
- package/lib/browser/location/index.js +2 -5
- package/lib/browser/location/index.js.map +1 -1
- package/lib/browser/location/location-renderer.d.ts +3 -3
- package/lib/browser/location/location-renderer.d.ts.map +1 -1
- package/lib/browser/location/location-renderer.js +42 -51
- package/lib/browser/location/location-renderer.js.map +1 -1
- package/lib/browser/location/location-renderer.spec.js +61 -64
- package/lib/browser/location/location-renderer.spec.js.map +1 -1
- package/lib/browser/location/location-service.js +1 -2
- package/lib/browser/location/location-service.js.map +1 -1
- package/lib/browser/remote-file-service-contribution.d.ts +2 -2
- package/lib/browser/remote-file-service-contribution.d.ts.map +1 -1
- package/lib/browser/remote-file-service-contribution.js +8 -12
- package/lib/browser/remote-file-service-contribution.js.map +1 -1
- package/lib/browser/upload/file-upload-service-impl.d.ts +3 -3
- package/lib/browser/upload/file-upload-service-impl.d.ts.map +1 -1
- package/lib/browser/upload/file-upload-service-impl.js +55 -64
- package/lib/browser/upload/file-upload-service-impl.js.map +1 -1
- package/lib/browser/vscode-file-service-contribution.d.ts +2 -2
- package/lib/browser/vscode-file-service-contribution.d.ts.map +1 -1
- package/lib/browser/vscode-file-service-contribution.js +23 -28
- package/lib/browser/vscode-file-service-contribution.js.map +1 -1
- package/lib/browser-only/browser-only-filesystem-frontend-module.js +21 -23
- package/lib/browser-only/browser-only-filesystem-frontend-module.js.map +1 -1
- package/lib/browser-only/browser-only-filesystem-provider-server.d.ts +1 -1
- package/lib/browser-only/browser-only-filesystem-provider-server.d.ts.map +1 -1
- package/lib/browser-only/browser-only-filesystem-provider-server.js +10 -13
- package/lib/browser-only/browser-only-filesystem-provider-server.js.map +1 -1
- package/lib/browser-only/download/file-download-command-contribution.d.ts +1 -1
- package/lib/browser-only/download/file-download-command-contribution.d.ts.map +1 -1
- package/lib/browser-only/download/file-download-command-contribution.js +14 -19
- package/lib/browser-only/download/file-download-command-contribution.js.map +1 -1
- package/lib/browser-only/download/file-download-frontend-module.js +8 -10
- package/lib/browser-only/download/file-download-frontend-module.js.map +1 -1
- package/lib/browser-only/download/file-download-service.d.ts +3 -3
- package/lib/browser-only/download/file-download-service.d.ts.map +1 -1
- package/lib/browser-only/download/file-download-service.js +26 -33
- package/lib/browser-only/download/file-download-service.js.map +1 -1
- package/lib/browser-only/file-search.d.ts.map +1 -1
- package/lib/browser-only/file-search.js +9 -15
- package/lib/browser-only/file-search.js.map +1 -1
- package/lib/browser-only/opfs-filesystem-initialization.d.ts +1 -1
- package/lib/browser-only/opfs-filesystem-initialization.d.ts.map +1 -1
- package/lib/browser-only/opfs-filesystem-initialization.js +6 -9
- package/lib/browser-only/opfs-filesystem-initialization.js.map +1 -1
- package/lib/browser-only/opfs-filesystem-provider.d.ts +2 -2
- package/lib/browser-only/opfs-filesystem-provider.d.ts.map +1 -1
- package/lib/browser-only/opfs-filesystem-provider.js +60 -68
- package/lib/browser-only/opfs-filesystem-provider.js.map +1 -1
- package/lib/browser-only/upload/file-upload-service-impl.d.ts +3 -3
- package/lib/browser-only/upload/file-upload-service-impl.d.ts.map +1 -1
- package/lib/browser-only/upload/file-upload-service-impl.js +51 -60
- package/lib/browser-only/upload/file-upload-service-impl.js.map +1 -1
- package/lib/common/delegating-file-system-provider.d.ts +1 -1
- package/lib/common/delegating-file-system-provider.d.ts.map +1 -1
- package/lib/common/delegating-file-system-provider.js +18 -22
- package/lib/common/delegating-file-system-provider.js.map +1 -1
- package/lib/common/download/file-download.js +5 -8
- package/lib/common/download/file-download.js.map +1 -1
- package/lib/common/file-upload.js +1 -4
- package/lib/common/file-upload.js.map +1 -1
- package/lib/common/files.js +38 -59
- package/lib/common/files.js.map +1 -1
- package/lib/common/files.spec.js +22 -25
- package/lib/common/files.spec.js.map +1 -1
- package/lib/common/filesystem-preferences.js +39 -44
- package/lib/common/filesystem-preferences.js.map +1 -1
- package/lib/common/filesystem-utils.d.ts +1 -1
- package/lib/common/filesystem-utils.d.ts.map +1 -1
- package/lib/common/filesystem-utils.js +2 -5
- package/lib/common/filesystem-utils.js.map +1 -1
- package/lib/common/filesystem-utils.spec.js +227 -229
- package/lib/common/filesystem-utils.spec.js.map +1 -1
- package/lib/common/filesystem-watcher-protocol.d.ts +1 -1
- package/lib/common/filesystem-watcher-protocol.d.ts.map +1 -1
- package/lib/common/filesystem-watcher-protocol.js +2 -5
- package/lib/common/filesystem-watcher-protocol.js.map +1 -1
- package/lib/common/filesystem.js +2 -5
- package/lib/common/filesystem.js.map +1 -1
- package/lib/common/index.d.ts +3 -3
- package/lib/common/index.d.ts.map +1 -1
- package/lib/common/index.js +3 -6
- package/lib/common/index.js.map +1 -1
- package/lib/common/io.d.ts +2 -2
- package/lib/common/io.d.ts.map +1 -1
- package/lib/common/io.js +10 -13
- package/lib/common/io.js.map +1 -1
- package/lib/common/remote-file-system-provider.d.ts +5 -5
- package/lib/common/remote-file-system-provider.d.ts.map +1 -1
- package/lib/common/remote-file-system-provider.js +81 -93
- package/lib/common/remote-file-system-provider.js.map +1 -1
- package/lib/common/upload/file-upload.js +1 -4
- package/lib/common/upload/file-upload.js.map +1 -1
- package/lib/electron-browser/file-dialog/electron-file-dialog-module.js +6 -8
- package/lib/electron-browser/file-dialog/electron-file-dialog-module.js.map +1 -1
- package/lib/electron-browser/file-dialog/electron-file-dialog-service.d.ts +3 -3
- package/lib/electron-browser/file-dialog/electron-file-dialog-service.d.ts.map +1 -1
- package/lib/electron-browser/file-dialog/electron-file-dialog-service.js +21 -23
- package/lib/electron-browser/file-dialog/electron-file-dialog-service.js.map +1 -1
- package/lib/electron-browser/file-dialog/electron-file-dialog-service.spec.js +33 -12
- package/lib/electron-browser/file-dialog/electron-file-dialog-service.spec.js.map +1 -1
- package/lib/electron-browser/preload.js +6 -9
- package/lib/electron-browser/preload.js.map +1 -1
- package/lib/electron-common/electron-api.d.ts +4 -0
- package/lib/electron-common/electron-api.d.ts.map +1 -1
- package/lib/electron-common/electron-api.js +2 -5
- package/lib/electron-common/electron-api.js.map +1 -1
- package/lib/electron-main/electron-api-main.d.ts.map +1 -1
- package/lib/electron-main/electron-api-main.js +19 -18
- package/lib/electron-main/electron-api-main.js.map +1 -1
- package/lib/electron-main/electron-main-module.js +6 -8
- package/lib/electron-main/electron-main-module.js.map +1 -1
- package/lib/node/archive/archive-extractor.d.ts +86 -0
- package/lib/node/archive/archive-extractor.d.ts.map +1 -0
- package/lib/node/archive/archive-extractor.js +290 -0
- package/lib/node/archive/archive-extractor.js.map +1 -0
- package/lib/node/archive/archive-extractor.spec.d.ts +2 -0
- package/lib/node/archive/archive-extractor.spec.d.ts.map +1 -0
- package/lib/node/archive/archive-extractor.spec.js +317 -0
- package/lib/node/archive/archive-extractor.spec.js.map +1 -0
- package/lib/node/archive/test/test-archives.d.ts +20 -0
- package/lib/node/archive/test/test-archives.d.ts.map +1 -0
- package/lib/node/archive/test/test-archives.js +97 -0
- package/lib/node/archive/test/test-archives.js.map +1 -0
- package/lib/node/disk-file-system-provider.d.ts +2 -2
- package/lib/node/disk-file-system-provider.d.ts.map +1 -1
- package/lib/node/disk-file-system-provider.js +111 -119
- package/lib/node/disk-file-system-provider.js.map +1 -1
- package/lib/node/disk-file-system-provider.spec.js +53 -56
- package/lib/node/disk-file-system-provider.spec.js.map +1 -1
- package/lib/node/download/directory-archiver.js +13 -16
- package/lib/node/download/directory-archiver.js.map +1 -1
- package/lib/node/download/directory-archiver.spec.js +20 -23
- package/lib/node/download/directory-archiver.spec.js.map +1 -1
- package/lib/node/download/file-download-backend-module.js +14 -16
- package/lib/node/download/file-download-backend-module.js.map +1 -1
- package/lib/node/download/file-download-cache.js +11 -15
- package/lib/node/download/file-download-cache.js.map +1 -1
- package/lib/node/download/file-download-endpoint.d.ts +1 -1
- package/lib/node/download/file-download-endpoint.d.ts.map +1 -1
- package/lib/node/download/file-download-endpoint.js +25 -31
- package/lib/node/download/file-download-endpoint.js.map +1 -1
- package/lib/node/download/file-download-handler.d.ts +2 -2
- package/lib/node/download/file-download-handler.d.ts.map +1 -1
- package/lib/node/download/file-download-handler.js +70 -76
- package/lib/node/download/file-download-handler.js.map +1 -1
- package/lib/node/download/test/mock-directory-archiver.d.ts +1 -1
- package/lib/node/download/test/mock-directory-archiver.d.ts.map +1 -1
- package/lib/node/download/test/mock-directory-archiver.js +2 -6
- package/lib/node/download/test/mock-directory-archiver.js.map +1 -1
- package/lib/node/file-change-collection.d.ts +1 -1
- package/lib/node/file-change-collection.d.ts.map +1 -1
- package/lib/node/file-change-collection.js +1 -5
- package/lib/node/file-change-collection.js.map +1 -1
- package/lib/node/file-change-collection.spec.js +5 -8
- package/lib/node/file-change-collection.spec.js.map +1 -1
- package/lib/node/filesystem-backend-module.d.ts +1 -1
- package/lib/node/filesystem-backend-module.d.ts.map +1 -1
- package/lib/node/filesystem-backend-module.js +60 -64
- package/lib/node/filesystem-backend-module.js.map +1 -1
- package/lib/node/filesystem-watcher-client.d.ts +2 -2
- package/lib/node/filesystem-watcher-client.d.ts.map +1 -1
- package/lib/node/filesystem-watcher-client.js +11 -16
- package/lib/node/filesystem-watcher-client.js.map +1 -1
- package/lib/node/filesystem-watcher-dispatcher.d.ts +1 -1
- package/lib/node/filesystem-watcher-dispatcher.d.ts.map +1 -1
- package/lib/node/filesystem-watcher-dispatcher.js +9 -13
- package/lib/node/filesystem-watcher-dispatcher.js.map +1 -1
- package/lib/node/filesystem-watcher-service-impl.d.ts +3 -3
- package/lib/node/filesystem-watcher-service-impl.d.ts.map +1 -1
- package/lib/node/filesystem-watcher-service-impl.js +7 -11
- package/lib/node/filesystem-watcher-service-impl.js.map +1 -1
- package/lib/node/filesystem-watcher-service-impl.spec.js +23 -26
- package/lib/node/filesystem-watcher-service-impl.spec.js.map +1 -1
- package/lib/node/filesystem-watcher.d.ts +1 -1
- package/lib/node/filesystem-watcher.d.ts.map +1 -1
- package/lib/node/filesystem-watcher.js +6 -11
- package/lib/node/filesystem-watcher.js.map +1 -1
- package/lib/node/nodejs-watcher/node-directory-watcher.d.ts +4 -4
- package/lib/node/nodejs-watcher/node-directory-watcher.d.ts.map +1 -1
- package/lib/node/nodejs-watcher/node-directory-watcher.js +20 -26
- package/lib/node/nodejs-watcher/node-directory-watcher.js.map +1 -1
- package/lib/node/nodejs-watcher/node-directory-watcher.spec.js +51 -54
- package/lib/node/nodejs-watcher/node-directory-watcher.spec.js.map +1 -1
- package/lib/node/nodejs-watcher/watch-request-router.d.ts +3 -3
- package/lib/node/nodejs-watcher/watch-request-router.d.ts.map +1 -1
- package/lib/node/nodejs-watcher/watch-request-router.js +8 -13
- package/lib/node/nodejs-watcher/watch-request-router.js.map +1 -1
- package/lib/node/nodejs-watcher/watcher-host.d.ts +1 -1
- package/lib/node/nodejs-watcher/watcher-host.d.ts.map +1 -1
- package/lib/node/nodejs-watcher/watcher-host.js +7 -12
- package/lib/node/nodejs-watcher/watcher-host.js.map +1 -1
- package/lib/node/parcel-watcher/index.js +6 -9
- package/lib/node/parcel-watcher/index.js.map +1 -1
- package/lib/node/parcel-watcher/parcel-filesystem-service.d.ts +4 -4
- package/lib/node/parcel-watcher/parcel-filesystem-service.d.ts.map +1 -1
- package/lib/node/parcel-watcher/parcel-filesystem-service.js +4 -8
- package/lib/node/parcel-watcher/parcel-filesystem-service.js.map +1 -1
- package/lib/node/parcel-watcher/parcel-filesystem-watcher.spec.js +23 -26
- package/lib/node/parcel-watcher/parcel-filesystem-watcher.spec.js.map +1 -1
- package/lib/node/parcel-watcher/parcel-options.js +1 -4
- package/lib/node/parcel-watcher/parcel-options.js.map +1 -1
- package/lib/node/parcel-watcher/parcel-watcher-exclude.spec.js +11 -16
- package/lib/node/parcel-watcher/parcel-watcher-exclude.spec.js.map +1 -1
- package/lib/node/parcel-watcher/parcel-watcher-retry.spec.js +11 -16
- package/lib/node/parcel-watcher/parcel-watcher-retry.spec.js.map +1 -1
- package/lib/node/parcel-watcher/parcel-watcher.d.ts +3 -3
- package/lib/node/parcel-watcher/parcel-watcher.d.ts.map +1 -1
- package/lib/node/parcel-watcher/parcel-watcher.js +28 -32
- package/lib/node/parcel-watcher/parcel-watcher.js.map +1 -1
- package/lib/node/test/watcher-test-helper.d.ts +1 -1
- package/lib/node/test/watcher-test-helper.d.ts.map +1 -1
- package/lib/node/test/watcher-test-helper.js +5 -10
- package/lib/node/test/watcher-test-helper.js.map +1 -1
- package/lib/node/upload/node-file-upload-service.d.ts +1 -1
- package/lib/node/upload/node-file-upload-service.d.ts.map +1 -1
- package/lib/node/upload/node-file-upload-service.js +20 -25
- package/lib/node/upload/node-file-upload-service.js.map +1 -1
- package/lib/node/upload/node-file-upload-service.spec.js +21 -24
- package/lib/node/upload/node-file-upload-service.spec.js.map +1 -1
- package/package.json +21 -5
- package/src/browser/breadcrumbs/filepath-breadcrumb.ts +1 -1
- package/src/browser/breadcrumbs/filepath-breadcrumbs-container.ts +1 -1
- package/src/browser/breadcrumbs/filepath-breadcrumbs-contribution.ts +5 -5
- package/src/browser/download/file-download-command-contribution.ts +1 -1
- package/src/browser/download/file-download-frontend-module.ts +3 -3
- package/src/browser/download/file-download-service.ts +1 -1
- package/src/browser/file-dialog/file-dialog-container.ts +5 -5
- package/src/browser/file-dialog/file-dialog-hidden-files-renderer.tsx +1 -1
- package/src/browser/file-dialog/file-dialog-model.ts +2 -2
- package/src/browser/file-dialog/file-dialog-module.ts +5 -5
- package/src/browser/file-dialog/file-dialog-service.ts +4 -4
- package/src/browser/file-dialog/file-dialog-tree-filters-renderer.spec.ts +2 -2
- package/src/browser/file-dialog/file-dialog-tree-filters-renderer.tsx +1 -1
- package/src/browser/file-dialog/file-dialog-tree.ts +2 -2
- package/src/browser/file-dialog/file-dialog-widget.ts +2 -2
- package/src/browser/file-dialog/file-dialog.ts +16 -13
- package/src/browser/file-dialog/index.ts +4 -4
- package/src/browser/file-resource.spec.ts +3 -3
- package/src/browser/file-resource.ts +3 -3
- package/src/browser/file-selection.ts +1 -1
- package/src/browser/file-service-activation.spec.ts +2 -2
- package/src/browser/file-service-copy.spec.ts +2 -2
- package/src/browser/file-service-watcher.spec.ts +2 -2
- package/src/browser/file-service.ts +6 -6
- package/src/browser/file-tree/file-tree-container.ts +3 -3
- package/src/browser/file-tree/file-tree-decorator-adapter.spec.ts +1 -1
- package/src/browser/file-tree/file-tree-decorator-adapter.ts +1 -1
- package/src/browser/file-tree/file-tree-label-provider.ts +1 -1
- package/src/browser/file-tree/file-tree-model.ts +12 -6
- package/src/browser/file-tree/file-tree-widget.tsx +8 -5
- package/src/browser/file-tree/file-tree.ts +3 -3
- package/src/browser/file-tree/index.ts +6 -6
- package/src/browser/filesystem-frontend-contribution.ts +6 -6
- package/src/browser/filesystem-frontend-module.ts +14 -14
- package/src/browser/filesystem-saveable-service.ts +2 -2
- package/src/browser/index.ts +4 -4
- package/src/browser/location/index.ts +2 -2
- package/src/browser/location/location-renderer.spec.ts +3 -3
- package/src/browser/location/location-renderer.tsx +3 -3
- package/src/browser/remote-file-service-contribution.ts +2 -2
- package/src/browser/upload/file-upload-service-impl.ts +5 -5
- package/src/browser/vscode-file-service-contribution.ts +2 -2
- package/src/browser-only/browser-only-filesystem-frontend-module.ts +7 -7
- package/src/browser-only/browser-only-filesystem-provider-server.ts +1 -1
- package/src/browser-only/download/file-download-command-contribution.ts +2 -2
- package/src/browser-only/download/file-download-frontend-module.ts +3 -3
- package/src/browser-only/download/file-download-service.ts +3 -3
- package/src/browser-only/file-search.ts +2 -1
- package/src/browser-only/opfs-filesystem-initialization.ts +1 -1
- package/src/browser-only/opfs-filesystem-provider.ts +3 -3
- package/src/browser-only/upload/file-upload-service-impl.ts +4 -4
- package/src/common/delegating-file-system-provider.ts +1 -1
- package/src/common/files.spec.ts +1 -1
- package/src/common/filesystem-utils.spec.ts +2 -2
- package/src/common/filesystem-utils.ts +1 -1
- package/src/common/filesystem-watcher-protocol.ts +1 -1
- package/src/common/index.ts +3 -3
- package/src/common/io.ts +2 -2
- package/src/common/remote-file-system-provider.ts +1 -1
- package/src/electron-browser/file-dialog/electron-file-dialog-module.ts +2 -2
- package/src/electron-browser/file-dialog/electron-file-dialog-service.spec.ts +30 -3
- package/src/electron-browser/file-dialog/electron-file-dialog-service.ts +8 -6
- package/src/electron-browser/preload.ts +1 -1
- package/src/electron-common/electron-api.ts +4 -0
- package/src/electron-main/electron-api-main.ts +7 -3
- package/src/electron-main/electron-main-module.ts +1 -1
- package/src/node/archive/archive-extractor.spec.ts +359 -0
- package/src/node/archive/archive-extractor.ts +350 -0
- package/src/node/archive/test/test-archives.ts +117 -0
- package/src/node/disk-file-system-provider.spec.ts +3 -3
- package/src/node/disk-file-system-provider.ts +7 -6
- package/src/node/download/directory-archiver.spec.ts +1 -1
- package/src/node/download/file-download-backend-module.ts +4 -4
- package/src/node/download/file-download-endpoint.ts +4 -3
- package/src/node/download/file-download-handler.ts +3 -3
- package/src/node/download/test/mock-directory-archiver.ts +1 -1
- package/src/node/file-change-collection.spec.ts +2 -2
- package/src/node/file-change-collection.ts +1 -1
- package/src/node/filesystem-backend-module.ts +15 -12
- package/src/node/filesystem-watcher-client.ts +2 -2
- package/src/node/filesystem-watcher-dispatcher.ts +1 -1
- package/src/node/filesystem-watcher-service-impl.spec.ts +5 -5
- package/src/node/filesystem-watcher-service-impl.ts +4 -4
- package/src/node/filesystem-watcher.ts +1 -1
- package/src/node/nodejs-watcher/node-directory-watcher.spec.ts +5 -5
- package/src/node/nodejs-watcher/node-directory-watcher.ts +5 -5
- package/src/node/nodejs-watcher/watch-request-router.ts +4 -4
- package/src/node/nodejs-watcher/watcher-host.ts +1 -1
- package/src/node/parcel-watcher/index.ts +2 -2
- package/src/node/parcel-watcher/parcel-filesystem-service.ts +4 -4
- package/src/node/parcel-watcher/parcel-filesystem-watcher.spec.ts +2 -2
- package/src/node/parcel-watcher/parcel-watcher-exclude.spec.ts +4 -8
- package/src/node/parcel-watcher/parcel-watcher-retry.spec.ts +4 -6
- package/src/node/parcel-watcher/parcel-watcher.ts +7 -6
- package/src/node/test/watcher-test-helper.ts +1 -1
- package/src/node/upload/node-file-upload-service.spec.ts +1 -1
- package/src/node/upload/node-file-upload-service.ts +6 -6
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// *****************************************************************************
|
|
3
2
|
// Copyright (C) 2020 TypeFox and others.
|
|
4
3
|
//
|
|
@@ -23,38 +22,36 @@
|
|
|
23
22
|
// and https://github.com/microsoft/vscode/blob/04c36be045a94fee58e5f8992d3e3fd980294a84/src/vs/workbench/services/textfile/electron-browser/nativeTextFileService.ts
|
|
24
23
|
// and https://github.com/microsoft/vscode/blob/04c36be045a94fee58e5f8992d3e3fd980294a84/src/vs/workbench/services/workingCopy/common/workingCopyFileService.ts
|
|
25
24
|
// and https://github.com/microsoft/vscode/blob/04c36be045a94fee58e5f8992d3e3fd980294a84/src/vs/workbench/services/workingCopy/common/workingCopyFileOperationParticipant.ts
|
|
26
|
-
|
|
27
|
-
exports.FileService = exports.TextFileOperationError = exports.FileServiceContribution = void 0;
|
|
28
|
-
const tslib_1 = require("tslib");
|
|
25
|
+
import { __decorate } from "tslib";
|
|
29
26
|
/* eslint-disable max-len */
|
|
30
27
|
/* eslint-disable @stylistic/brace-style, @stylistic/semi-spacing */
|
|
31
28
|
/* eslint-disable @typescript-eslint/no-shadow */
|
|
32
29
|
/* eslint-disable no-null/no-null */
|
|
33
30
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
class TextFileOperationError extends
|
|
31
|
+
import { injectable, inject, named, postConstruct } from '@theia/core/shared/inversify';
|
|
32
|
+
import { timeout, Deferred } from '@theia/core/lib/common/promise-util';
|
|
33
|
+
import { CancellationToken, CancellationTokenSource } from '@theia/core/lib/common/cancellation';
|
|
34
|
+
import { Disposable, DisposableCollection } from '@theia/core/lib/common/disposable';
|
|
35
|
+
import { WaitUntilEvent, Emitter, AsyncEmitter } from '@theia/core/lib/common/event';
|
|
36
|
+
import { ContributionProvider } from '@theia/core/lib/common/contribution-provider';
|
|
37
|
+
import { TernarySearchTree } from '@theia/core/lib/common/ternary-search-tree';
|
|
38
|
+
import { ensureFileSystemProviderError, etag, ETAG_DISABLED, FileChangesEvent, FileOperationError, FileOperationEvent, FileSystemProviderErrorCode, FileType, hasFileFolderCopyCapability, hasOpenReadWriteCloseCapability, hasReadWriteCapability, FileStat, toFileOperationResult, toFileSystemProviderErrorCode, hasAccessCapability, hasUpdateCapability, hasFileReadStreamCapability, ReadOnlyMessageFileSystemProvider } from '../common/files.js';
|
|
39
|
+
import { BinaryBuffer, BinaryBufferReadable, BinaryBufferReadableStream, BinaryBufferReadableBufferedStream, BinaryBufferWriteableStream } from '@theia/core/lib/common/buffer';
|
|
40
|
+
import { isReadableStream, isReadableBufferedStream, transform, consumeStream, peekStream, peekReadable } from '@theia/core/lib/common/stream';
|
|
41
|
+
import { LabelProvider } from '@theia/core/lib/browser/label-provider';
|
|
42
|
+
import { FileSystemPreferences } from '../common/filesystem-preferences.js';
|
|
43
|
+
import { ProgressService } from '@theia/core/lib/common/progress-service';
|
|
44
|
+
import { DelegatingFileSystemProvider } from '../common/delegating-file-system-provider.js';
|
|
45
|
+
import { EncodingRegistry } from '@theia/core/lib/browser/encoding-registry';
|
|
46
|
+
import { UTF8, UTF8_with_bom } from '@theia/core/lib/common/encodings';
|
|
47
|
+
import { EncodingService } from '@theia/core/lib/common/encoding-service';
|
|
48
|
+
import { Minimatch } from 'minimatch';
|
|
49
|
+
import { readFileIntoStream } from '../common/io.js';
|
|
50
|
+
import { FileSystemWatcherErrorHandler } from './filesystem-watcher-error-handler.js';
|
|
51
|
+
import { FileSystemUtils } from '../common/filesystem-utils.js';
|
|
52
|
+
import { nls, ILogger } from '@theia/core';
|
|
53
|
+
export const FileServiceContribution = Symbol('FileServiceContribution');
|
|
54
|
+
export class TextFileOperationError extends FileOperationError {
|
|
58
55
|
constructor(message, textFileOperationResult, options) {
|
|
59
56
|
super(message, 11 /* FileOperationResult.FILE_OTHER_ERROR */);
|
|
60
57
|
this.textFileOperationResult = textFileOperationResult;
|
|
@@ -62,7 +59,6 @@ class TextFileOperationError extends files_1.FileOperationError {
|
|
|
62
59
|
Object.setPrototypeOf(this, TextFileOperationError.prototype);
|
|
63
60
|
}
|
|
64
61
|
}
|
|
65
|
-
exports.TextFileOperationError = TextFileOperationError;
|
|
66
62
|
/**
|
|
67
63
|
* The {@link FileService} is the common facade responsible for all interactions with file systems.
|
|
68
64
|
* It manages all registered {@link FileSystemProvider}s and
|
|
@@ -74,19 +70,19 @@ let FileService = class FileService {
|
|
|
74
70
|
this.BUFFER_SIZE = 64 * 1024;
|
|
75
71
|
// #region Events
|
|
76
72
|
this.correlationIds = 0;
|
|
77
|
-
this.onWillRunUserOperationEmitter = new
|
|
73
|
+
this.onWillRunUserOperationEmitter = new AsyncEmitter();
|
|
78
74
|
/**
|
|
79
75
|
* An event that is emitted when file operation is being performed.
|
|
80
76
|
* This event is triggered by user gestures.
|
|
81
77
|
*/
|
|
82
78
|
this.onWillRunUserOperation = this.onWillRunUserOperationEmitter.event;
|
|
83
|
-
this.onDidFailUserOperationEmitter = new
|
|
79
|
+
this.onDidFailUserOperationEmitter = new AsyncEmitter();
|
|
84
80
|
/**
|
|
85
81
|
* An event that is emitted when file operation is failed.
|
|
86
82
|
* This event is triggered by user gestures.
|
|
87
83
|
*/
|
|
88
84
|
this.onDidFailUserOperation = this.onDidFailUserOperationEmitter.event;
|
|
89
|
-
this.onDidRunUserOperationEmitter = new
|
|
85
|
+
this.onDidRunUserOperationEmitter = new AsyncEmitter();
|
|
90
86
|
/**
|
|
91
87
|
* An event that is emitted when file operation is finished.
|
|
92
88
|
* This event is triggered by user gestures.
|
|
@@ -94,21 +90,21 @@ let FileService = class FileService {
|
|
|
94
90
|
this.onDidRunUserOperation = this.onDidRunUserOperationEmitter.event;
|
|
95
91
|
// #endregion
|
|
96
92
|
// #region File System Provider
|
|
97
|
-
this.onDidChangeFileSystemProviderRegistrationsEmitter = new
|
|
93
|
+
this.onDidChangeFileSystemProviderRegistrationsEmitter = new Emitter();
|
|
98
94
|
this.onDidChangeFileSystemProviderRegistrations = this.onDidChangeFileSystemProviderRegistrationsEmitter.event;
|
|
99
|
-
this.onWillActivateFileSystemProviderEmitter = new
|
|
95
|
+
this.onWillActivateFileSystemProviderEmitter = new Emitter();
|
|
100
96
|
/**
|
|
101
97
|
* See `FileServiceContribution.registerProviders`.
|
|
102
98
|
*/
|
|
103
99
|
this.onWillActivateFileSystemProvider = this.onWillActivateFileSystemProviderEmitter.event;
|
|
104
|
-
this.onDidChangeFileSystemProviderCapabilitiesEmitter = new
|
|
100
|
+
this.onDidChangeFileSystemProviderCapabilitiesEmitter = new Emitter();
|
|
105
101
|
this.onDidChangeFileSystemProviderCapabilities = this.onDidChangeFileSystemProviderCapabilitiesEmitter.event;
|
|
106
|
-
this.onDidChangeFileSystemProviderReadOnlyMessageEmitter = new
|
|
102
|
+
this.onDidChangeFileSystemProviderReadOnlyMessageEmitter = new Emitter();
|
|
107
103
|
this.onDidChangeFileSystemProviderReadOnlyMessage = this.onDidChangeFileSystemProviderReadOnlyMessageEmitter.event;
|
|
108
104
|
this.providers = new Map();
|
|
109
105
|
this.activations = new Map();
|
|
110
106
|
// #endregion
|
|
111
|
-
this.onDidRunOperationEmitter = new
|
|
107
|
+
this.onDidRunOperationEmitter = new Emitter();
|
|
112
108
|
/**
|
|
113
109
|
* An event that is emitted when operation is finished.
|
|
114
110
|
* This event is triggered by user gestures and programmatically.
|
|
@@ -116,7 +112,7 @@ let FileService = class FileService {
|
|
|
116
112
|
this.onDidRunOperation = this.onDidRunOperationEmitter.event;
|
|
117
113
|
// #endregion
|
|
118
114
|
// #region File Watching
|
|
119
|
-
this.onDidFilesChangeEmitter = new
|
|
115
|
+
this.onDidFilesChangeEmitter = new Emitter();
|
|
120
116
|
this.activeWatchers = new Map();
|
|
121
117
|
this.recursiveWatcherIndexes = new Map();
|
|
122
118
|
// #endregion
|
|
@@ -144,14 +140,14 @@ let FileService = class FileService {
|
|
|
144
140
|
}
|
|
145
141
|
this.providers.set(scheme, provider);
|
|
146
142
|
this.onDidChangeFileSystemProviderRegistrationsEmitter.fire({ added: true, scheme, provider });
|
|
147
|
-
const providerDisposables = new
|
|
148
|
-
providerDisposables.push(provider.onDidChangeFile(changes => this.onDidFilesChangeEmitter.fire(new
|
|
143
|
+
const providerDisposables = new DisposableCollection();
|
|
144
|
+
providerDisposables.push(provider.onDidChangeFile(changes => this.onDidFilesChangeEmitter.fire(new FileChangesEvent(changes))));
|
|
149
145
|
providerDisposables.push(provider.onFileWatchError(() => this.handleFileWatchError()));
|
|
150
146
|
providerDisposables.push(provider.onDidChangeCapabilities(() => this.onDidChangeFileSystemProviderCapabilitiesEmitter.fire({ provider, scheme })));
|
|
151
|
-
if (
|
|
147
|
+
if (ReadOnlyMessageFileSystemProvider.is(provider)) {
|
|
152
148
|
providerDisposables.push(provider.onDidChangeReadOnlyMessage(message => this.onDidChangeFileSystemProviderReadOnlyMessageEmitter.fire({ provider, scheme, message })));
|
|
153
149
|
}
|
|
154
|
-
return
|
|
150
|
+
return Disposable.create(() => {
|
|
155
151
|
this.onDidChangeFileSystemProviderRegistrationsEmitter.fire({ added: false, scheme, provider });
|
|
156
152
|
this.providers.delete(scheme);
|
|
157
153
|
this.recursiveWatcherIndexes.delete(provider);
|
|
@@ -171,7 +167,7 @@ let FileService = class FileService {
|
|
|
171
167
|
}
|
|
172
168
|
let activation = this.activations.get(scheme);
|
|
173
169
|
if (!activation) {
|
|
174
|
-
const deferredActivation = new
|
|
170
|
+
const deferredActivation = new Deferred();
|
|
175
171
|
this.activations.set(scheme, activation = deferredActivation.promise);
|
|
176
172
|
// Resolve the activation as soon as a provider is registered for the scheme. Otherwise a
|
|
177
173
|
// slow or dangling `onWillActivateFileSystemProvider` listener whose `waitUntil` promise
|
|
@@ -182,7 +178,7 @@ let FileService = class FileService {
|
|
|
182
178
|
}
|
|
183
179
|
});
|
|
184
180
|
deferredActivation.promise.then(() => registration.dispose(), () => registration.dispose());
|
|
185
|
-
|
|
181
|
+
WaitUntilEvent.fire(this.onWillActivateFileSystemProviderEmitter, { scheme }).then(() => {
|
|
186
182
|
provider = this.providers.get(scheme);
|
|
187
183
|
if (!provider) {
|
|
188
184
|
const error = new Error();
|
|
@@ -211,7 +207,7 @@ let FileService = class FileService {
|
|
|
211
207
|
}
|
|
212
208
|
getReadOnlyMessage(resource) {
|
|
213
209
|
const provider = this.providers.get(resource.scheme);
|
|
214
|
-
if (
|
|
210
|
+
if (ReadOnlyMessageFileSystemProvider.is(provider)) {
|
|
215
211
|
return provider.readOnlyMessage;
|
|
216
212
|
}
|
|
217
213
|
return undefined;
|
|
@@ -239,20 +235,20 @@ let FileService = class FileService {
|
|
|
239
235
|
async withProvider(resource) {
|
|
240
236
|
// Assert path is absolute
|
|
241
237
|
if (!resource.path.isAbsolute) {
|
|
242
|
-
throw new
|
|
238
|
+
throw new FileOperationError(nls.localizeByDefault("Unable to resolve filesystem provider with relative file path '{0}'", this.resourceForError(resource)), 8 /* FileOperationResult.FILE_INVALID_PATH */);
|
|
243
239
|
}
|
|
244
240
|
return this.activateProvider(resource.scheme);
|
|
245
241
|
}
|
|
246
242
|
async withReadProvider(resource) {
|
|
247
243
|
const provider = await this.withProvider(resource);
|
|
248
|
-
if (
|
|
244
|
+
if (hasOpenReadWriteCloseCapability(provider) || hasReadWriteCapability(provider)) {
|
|
249
245
|
return provider;
|
|
250
246
|
}
|
|
251
247
|
throw new Error(`Filesystem provider for scheme '${resource.scheme}' neither has FileReadWrite, FileReadStream nor FileOpenReadWriteClose capability which is needed for the read operation.`);
|
|
252
248
|
}
|
|
253
249
|
async withWriteProvider(resource) {
|
|
254
250
|
const provider = await this.withProvider(resource);
|
|
255
|
-
if (
|
|
251
|
+
if (hasOpenReadWriteCloseCapability(provider) || hasReadWriteCapability(provider)) {
|
|
256
252
|
return provider;
|
|
257
253
|
}
|
|
258
254
|
throw new Error(`Filesystem provider for scheme '${resource.scheme}' neither has FileReadWrite nor FileOpenReadWriteClose capability which is needed for the write operation.`);
|
|
@@ -263,11 +259,11 @@ let FileService = class FileService {
|
|
|
263
259
|
}
|
|
264
260
|
catch (error) {
|
|
265
261
|
// Specially handle file not found case as file operation result
|
|
266
|
-
if (
|
|
267
|
-
throw new
|
|
262
|
+
if (toFileSystemProviderErrorCode(error) === FileSystemProviderErrorCode.FileNotFound) {
|
|
263
|
+
throw new FileOperationError(nls.localizeByDefault("Unable to resolve nonexistent file '{0}'", this.resourceForError(resource)), 1 /* FileOperationResult.FILE_NOT_FOUND */);
|
|
268
264
|
}
|
|
269
265
|
// Bubble up any other error as is
|
|
270
|
-
throw
|
|
266
|
+
throw ensureFileSystemProviderError(error);
|
|
271
267
|
}
|
|
272
268
|
}
|
|
273
269
|
async doResolveFile(resource, options) {
|
|
@@ -280,7 +276,7 @@ let FileService = class FileService {
|
|
|
280
276
|
return this.toFileStat(provider, resource, stat, undefined, !!resolveMetadata, (stat, siblings) => {
|
|
281
277
|
// lazy trie to check for recursive resolving
|
|
282
278
|
if (!trie) {
|
|
283
|
-
trie =
|
|
279
|
+
trie = TernarySearchTree.forUris(!!(provider.capabilities & 1024 /* FileSystemProviderCapabilities.PathCaseSensitive */));
|
|
284
280
|
trie.set(resource, true);
|
|
285
281
|
if (Array.isArray(resolveTo) && resolveTo.length) {
|
|
286
282
|
resolveTo.forEach(uri => trie.set(uri, true));
|
|
@@ -298,7 +294,7 @@ let FileService = class FileService {
|
|
|
298
294
|
});
|
|
299
295
|
}
|
|
300
296
|
async toFileStat(provider, resource, stat, siblings, resolveMetadata, recurse) {
|
|
301
|
-
const fileStat =
|
|
297
|
+
const fileStat = FileStat.fromStat(resource, stat);
|
|
302
298
|
// check to recurse for directories
|
|
303
299
|
if (fileStat.isDirectory && recurse(fileStat, siblings)) {
|
|
304
300
|
try {
|
|
@@ -363,7 +359,7 @@ let FileService = class FileService {
|
|
|
363
359
|
*/
|
|
364
360
|
async access(resource, mode) {
|
|
365
361
|
const provider = await this.withProvider(resource);
|
|
366
|
-
if (!
|
|
362
|
+
if (!hasAccessCapability(provider)) {
|
|
367
363
|
return false;
|
|
368
364
|
}
|
|
369
365
|
try {
|
|
@@ -389,7 +385,7 @@ let FileService = class FileService {
|
|
|
389
385
|
*/
|
|
390
386
|
async fsPath(resource) {
|
|
391
387
|
const provider = await this.withProvider(resource);
|
|
392
|
-
if (!
|
|
388
|
+
if (!hasAccessCapability(provider)) {
|
|
393
389
|
return resource.path.toString();
|
|
394
390
|
}
|
|
395
391
|
return provider.fsPath(resource);
|
|
@@ -430,15 +426,15 @@ let FileService = class FileService {
|
|
|
430
426
|
});
|
|
431
427
|
return {
|
|
432
428
|
...bufferStream,
|
|
433
|
-
encoding: decoder.detected.encoding ||
|
|
434
|
-
value: await
|
|
429
|
+
encoding: decoder.detected.encoding || UTF8,
|
|
430
|
+
value: await consumeStream(decoder.stream, strings => strings.join(''))
|
|
435
431
|
};
|
|
436
432
|
}
|
|
437
433
|
async readStream(resource, options) {
|
|
438
434
|
const [bufferStream, decoder] = await this.doRead(resource, options);
|
|
439
435
|
return {
|
|
440
436
|
...bufferStream,
|
|
441
|
-
encoding: decoder.detected.encoding ||
|
|
437
|
+
encoding: decoder.detected.encoding || UTF8,
|
|
442
438
|
value: decoder.stream
|
|
443
439
|
};
|
|
444
440
|
}
|
|
@@ -450,7 +446,7 @@ let FileService = class FileService {
|
|
|
450
446
|
const content = await this.readFile(resource, options);
|
|
451
447
|
bufferStream = {
|
|
452
448
|
...content,
|
|
453
|
-
value:
|
|
449
|
+
value: BinaryBufferReadableStream.fromBuffer(content.value)
|
|
454
450
|
};
|
|
455
451
|
}
|
|
456
452
|
else {
|
|
@@ -462,7 +458,7 @@ let FileService = class FileService {
|
|
|
462
458
|
});
|
|
463
459
|
// validate binary
|
|
464
460
|
if (options?.acceptTextOnly && decoder.detected.seemsBinary) {
|
|
465
|
-
throw new TextFileOperationError(
|
|
461
|
+
throw new TextFileOperationError(nls.localizeByDefault('File seems to be binary and cannot be opened as text'), 0 /* TextFileOperationResult.FILE_IS_BINARY */, options);
|
|
466
462
|
}
|
|
467
463
|
return [bufferStream, decoder];
|
|
468
464
|
}
|
|
@@ -481,7 +477,7 @@ let FileService = class FileService {
|
|
|
481
477
|
const provider = this.throwIfFileSystemIsReadonly(await this.withWriteProvider(resource), resource);
|
|
482
478
|
try {
|
|
483
479
|
await this.validateWriteFile(provider, resource, options);
|
|
484
|
-
if (
|
|
480
|
+
if (hasUpdateCapability(provider)) {
|
|
485
481
|
const encoding = await this.getEncodingForResource(resource, options ? options.encoding : undefined);
|
|
486
482
|
;
|
|
487
483
|
const stat = await provider.updateFile(resource, changes, {
|
|
@@ -489,7 +485,7 @@ let FileService = class FileService {
|
|
|
489
485
|
writeEncoding: encoding,
|
|
490
486
|
overwriteEncoding: options.overwriteEncoding || false
|
|
491
487
|
});
|
|
492
|
-
return Object.assign(
|
|
488
|
+
return Object.assign(FileStat.fromStat(resource, stat), { encoding: stat.encoding });
|
|
493
489
|
}
|
|
494
490
|
else {
|
|
495
491
|
throw new Error('incremental file update is not supported');
|
|
@@ -501,15 +497,15 @@ let FileService = class FileService {
|
|
|
501
497
|
}
|
|
502
498
|
// #endregion
|
|
503
499
|
// #region File Reading/Writing
|
|
504
|
-
async createFile(resource, bufferOrReadableOrStream =
|
|
500
|
+
async createFile(resource, bufferOrReadableOrStream = BinaryBuffer.fromString(''), options) {
|
|
505
501
|
// validate overwrite
|
|
506
502
|
if (!options?.overwrite && await this.exists(resource)) {
|
|
507
|
-
throw new
|
|
503
|
+
throw new FileOperationError(nls.localizeByDefault("Unable to create file '{0}' that already exists when overwrite flag is not set", this.resourceForError(resource)), 3 /* FileOperationResult.FILE_MODIFIED_SINCE */, options);
|
|
508
504
|
}
|
|
509
505
|
// do write into file (this will create it too)
|
|
510
506
|
const fileStat = await this.writeFile(resource, bufferOrReadableOrStream);
|
|
511
507
|
// events
|
|
512
|
-
this.onDidRunOperationEmitter.fire(new
|
|
508
|
+
this.onDidRunOperationEmitter.fire(new FileOperationEvent(resource, 0 /* FileOperation.CREATE */, fileStat));
|
|
513
509
|
return fileStat;
|
|
514
510
|
}
|
|
515
511
|
async writeFile(resource, bufferOrReadableOrStream, options) {
|
|
@@ -526,30 +522,30 @@ let FileService = class FileService {
|
|
|
526
522
|
// unbuffered to reduce the overhead. If the Readable has more data to provide
|
|
527
523
|
// we continue to write buffered.
|
|
528
524
|
let bufferOrReadableOrStreamOrBufferedStream;
|
|
529
|
-
if (
|
|
530
|
-
if (
|
|
531
|
-
const bufferedStream = await
|
|
525
|
+
if (hasReadWriteCapability(provider) && !(bufferOrReadableOrStream instanceof BinaryBuffer)) {
|
|
526
|
+
if (isReadableStream(bufferOrReadableOrStream)) {
|
|
527
|
+
const bufferedStream = await peekStream(bufferOrReadableOrStream, 3);
|
|
532
528
|
if (bufferedStream.ended) {
|
|
533
|
-
bufferOrReadableOrStreamOrBufferedStream =
|
|
529
|
+
bufferOrReadableOrStreamOrBufferedStream = BinaryBuffer.concat(bufferedStream.buffer);
|
|
534
530
|
}
|
|
535
531
|
else {
|
|
536
532
|
bufferOrReadableOrStreamOrBufferedStream = bufferedStream;
|
|
537
533
|
}
|
|
538
534
|
}
|
|
539
535
|
else {
|
|
540
|
-
bufferOrReadableOrStreamOrBufferedStream =
|
|
536
|
+
bufferOrReadableOrStreamOrBufferedStream = peekReadable(bufferOrReadableOrStream, data => BinaryBuffer.concat(data), 3);
|
|
541
537
|
}
|
|
542
538
|
}
|
|
543
539
|
else {
|
|
544
540
|
bufferOrReadableOrStreamOrBufferedStream = bufferOrReadableOrStream;
|
|
545
541
|
}
|
|
546
542
|
// write file: unbuffered (only if data to write is a buffer, or the provider has no buffered write capability)
|
|
547
|
-
if (!
|
|
543
|
+
if (!hasOpenReadWriteCloseCapability(provider) || (hasReadWriteCapability(provider) && bufferOrReadableOrStreamOrBufferedStream instanceof BinaryBuffer)) {
|
|
548
544
|
await this.doWriteUnbuffered(provider, resource, bufferOrReadableOrStreamOrBufferedStream);
|
|
549
545
|
}
|
|
550
546
|
// write file: buffered
|
|
551
547
|
else {
|
|
552
|
-
await this.doWriteBuffered(provider, resource, bufferOrReadableOrStreamOrBufferedStream instanceof
|
|
548
|
+
await this.doWriteBuffered(provider, resource, bufferOrReadableOrStreamOrBufferedStream instanceof BinaryBuffer ? BinaryBufferReadable.fromBuffer(bufferOrReadableOrStreamOrBufferedStream) : bufferOrReadableOrStreamOrBufferedStream);
|
|
553
549
|
}
|
|
554
550
|
}
|
|
555
551
|
catch (error) {
|
|
@@ -566,11 +562,11 @@ let FileService = class FileService {
|
|
|
566
562
|
return undefined; // file might not exist
|
|
567
563
|
}
|
|
568
564
|
// file cannot be directory
|
|
569
|
-
if ((stat.type &
|
|
570
|
-
throw new
|
|
565
|
+
if ((stat.type & FileType.Directory) !== 0) {
|
|
566
|
+
throw new FileOperationError(nls.localizeByDefault("Unable to write file '{0}' that is actually a directory", this.resourceForError(resource)), 0 /* FileOperationResult.FILE_IS_DIRECTORY */, options);
|
|
571
567
|
}
|
|
572
568
|
if (this.modifiedSince(stat, options)) {
|
|
573
|
-
throw new
|
|
569
|
+
throw new FileOperationError(nls.localizeByDefault('File Modified Since'), 3 /* FileOperationResult.FILE_MODIFIED_SINCE */, options);
|
|
574
570
|
}
|
|
575
571
|
return stat;
|
|
576
572
|
}
|
|
@@ -589,9 +585,9 @@ let FileService = class FileService {
|
|
|
589
585
|
* the file content for comparison which would be much slower to compute.
|
|
590
586
|
*/
|
|
591
587
|
modifiedSince(stat, options) {
|
|
592
|
-
return !!options && typeof options.mtime === 'number' && typeof options.etag === 'string' && options.etag !==
|
|
588
|
+
return !!options && typeof options.mtime === 'number' && typeof options.etag === 'string' && options.etag !== ETAG_DISABLED &&
|
|
593
589
|
typeof stat.mtime === 'number' && typeof stat.size === 'number' &&
|
|
594
|
-
options.mtime < stat.mtime && options.etag !==
|
|
590
|
+
options.mtime < stat.mtime && options.etag !== etag({ mtime: options.mtime /* not using stat.mtime for a reason, see above */, size: stat.size });
|
|
595
591
|
}
|
|
596
592
|
shouldReadUnbuffered(options) {
|
|
597
593
|
// optimization: since we know that the caller does not
|
|
@@ -613,7 +609,7 @@ let FileService = class FileService {
|
|
|
613
609
|
});
|
|
614
610
|
return {
|
|
615
611
|
...stream,
|
|
616
|
-
value: await
|
|
612
|
+
value: await BinaryBufferReadableStream.toBuffer(stream.value)
|
|
617
613
|
};
|
|
618
614
|
}
|
|
619
615
|
async readFileStream(resource, options) {
|
|
@@ -625,7 +621,7 @@ let FileService = class FileService {
|
|
|
625
621
|
// when any error occurs. this allows us to resolve
|
|
626
622
|
// the content of the file while resolving metadata
|
|
627
623
|
// but still cancel the operation in certain cases.
|
|
628
|
-
const cancellableSource = new
|
|
624
|
+
const cancellableSource = new CancellationTokenSource();
|
|
629
625
|
// validate read operation
|
|
630
626
|
const statPromise = this.validateReadFile(resource, options).then(stat => stat, error => {
|
|
631
627
|
cancellableSource.cancel();
|
|
@@ -636,16 +632,16 @@ let FileService = class FileService {
|
|
|
636
632
|
// due to the likelyhood of hitting a NOT_MODIFIED_SINCE result.
|
|
637
633
|
// otherwise, we let it run in parallel to the file reading for
|
|
638
634
|
// optimal startup performance.
|
|
639
|
-
if (options && typeof options.etag === 'string' && options.etag !==
|
|
635
|
+
if (options && typeof options.etag === 'string' && options.etag !== ETAG_DISABLED) {
|
|
640
636
|
await statPromise;
|
|
641
637
|
}
|
|
642
638
|
let fileStreamPromise;
|
|
643
639
|
// read unbuffered (only if either preferred, or the provider has no buffered read capability)
|
|
644
|
-
if (!(
|
|
640
|
+
if (!(hasOpenReadWriteCloseCapability(provider) || hasFileReadStreamCapability(provider)) || (hasReadWriteCapability(provider) && options?.preferUnbuffered)) {
|
|
645
641
|
fileStreamPromise = this.readFileUnbuffered(provider, resource, options);
|
|
646
642
|
}
|
|
647
643
|
// read streamed (always prefer over primitive buffered read)
|
|
648
|
-
else if (
|
|
644
|
+
else if (hasFileReadStreamCapability(provider)) {
|
|
649
645
|
fileStreamPromise = Promise.resolve(this.readFileStreamed(provider, resource, cancellableSource.token, options));
|
|
650
646
|
}
|
|
651
647
|
// read buffered
|
|
@@ -664,14 +660,14 @@ let FileService = class FileService {
|
|
|
664
660
|
}
|
|
665
661
|
readFileStreamed(provider, resource, token, options = Object.create(null)) {
|
|
666
662
|
const fileStream = provider.readFileStream(resource, options, token);
|
|
667
|
-
return
|
|
668
|
-
data: data => data instanceof
|
|
663
|
+
return transform(fileStream, {
|
|
664
|
+
data: data => data instanceof BinaryBuffer ? data : BinaryBuffer.wrap(data),
|
|
669
665
|
error: error => this.asFileOperationError("Unable to read file '{0}' ({1})", resource, error, options)
|
|
670
|
-
}, data =>
|
|
666
|
+
}, data => BinaryBuffer.concat(data));
|
|
671
667
|
}
|
|
672
668
|
readFileBuffered(provider, resource, token, options = Object.create(null)) {
|
|
673
|
-
const stream =
|
|
674
|
-
|
|
669
|
+
const stream = BinaryBufferWriteableStream.create();
|
|
670
|
+
readFileIntoStream(provider, resource, stream, data => data, {
|
|
675
671
|
...options,
|
|
676
672
|
bufferSize: this.BUFFER_SIZE,
|
|
677
673
|
errorTransformer: error => this.asFileOperationError("Unable to read file '{0}' ({1})", resource, error, options)
|
|
@@ -682,7 +678,7 @@ let FileService = class FileService {
|
|
|
682
678
|
throw this.asFileOperationError(message, resource, error, options);
|
|
683
679
|
}
|
|
684
680
|
asFileOperationError(message, resource, error, options) {
|
|
685
|
-
const fileOperationError = new
|
|
681
|
+
const fileOperationError = new FileOperationError(nls.localizeByDefault(message, this.resourceForError(resource), ensureFileSystemProviderError(error).toString()), toFileOperationResult(error), options);
|
|
686
682
|
fileOperationError.stack = `${fileOperationError.stack}\nCaused by: ${error.stack}`;
|
|
687
683
|
return fileOperationError;
|
|
688
684
|
}
|
|
@@ -698,17 +694,17 @@ let FileService = class FileService {
|
|
|
698
694
|
}
|
|
699
695
|
// Throw if file is too large to load
|
|
700
696
|
this.validateReadFileLimits(resource, buffer.byteLength, options);
|
|
701
|
-
return
|
|
697
|
+
return BinaryBufferReadableStream.fromBuffer(BinaryBuffer.wrap(buffer));
|
|
702
698
|
}
|
|
703
699
|
async validateReadFile(resource, options) {
|
|
704
700
|
const stat = await this.resolve(resource, { resolveMetadata: true });
|
|
705
701
|
// Throw if resource is a directory
|
|
706
702
|
if (stat.isDirectory) {
|
|
707
|
-
throw new
|
|
703
|
+
throw new FileOperationError(nls.localizeByDefault("Unable to read file '{0}' that is actually a directory", this.resourceForError(resource)), 0 /* FileOperationResult.FILE_IS_DIRECTORY */, options);
|
|
708
704
|
}
|
|
709
705
|
// Throw if file not modified since (unless disabled)
|
|
710
|
-
if (options && typeof options.etag === 'string' && options.etag !==
|
|
711
|
-
throw new
|
|
706
|
+
if (options && typeof options.etag === 'string' && options.etag !== ETAG_DISABLED && options.etag === stat.etag) {
|
|
707
|
+
throw new FileOperationError(nls.localizeByDefault('File not modified since'), 2 /* FileOperationResult.FILE_NOT_MODIFIED_SINCE */, options);
|
|
712
708
|
}
|
|
713
709
|
// Throw if file is too large to load
|
|
714
710
|
this.validateReadFileLimits(resource, stat.size, options);
|
|
@@ -724,7 +720,7 @@ let FileService = class FileService {
|
|
|
724
720
|
tooLargeErrorResult = 7 /* FileOperationResult.FILE_TOO_LARGE */;
|
|
725
721
|
}
|
|
726
722
|
if (typeof tooLargeErrorResult === 'number') {
|
|
727
|
-
throw new
|
|
723
|
+
throw new FileOperationError(nls.localizeByDefault("Unable to read file '{0}' that is too large to open", this.resourceForError(resource)), tooLargeErrorResult);
|
|
728
724
|
}
|
|
729
725
|
}
|
|
730
726
|
}
|
|
@@ -755,7 +751,7 @@ let FileService = class FileService {
|
|
|
755
751
|
const mode = await this.doMoveCopy(sourceProvider, source, targetProvider, target, 'move', !!overwrite);
|
|
756
752
|
// resolve and send events
|
|
757
753
|
const fileStat = await this.resolve(target, { resolveMetadata: true });
|
|
758
|
-
this.onDidRunOperationEmitter.fire(new
|
|
754
|
+
this.onDidRunOperationEmitter.fire(new FileOperationEvent(source, mode === 'move' ? 2 /* FileOperation.MOVE */ : 3 /* FileOperation.COPY */, fileStat));
|
|
759
755
|
return fileStat;
|
|
760
756
|
}
|
|
761
757
|
async copy(source, target, options) {
|
|
@@ -783,7 +779,7 @@ let FileService = class FileService {
|
|
|
783
779
|
const mode = await this.doMoveCopy(sourceProvider, source, targetProvider, target, 'copy', !!overwrite);
|
|
784
780
|
// resolve and send events
|
|
785
781
|
const fileStat = await this.resolve(target, { resolveMetadata: true });
|
|
786
|
-
this.onDidRunOperationEmitter.fire(new
|
|
782
|
+
this.onDidRunOperationEmitter.fire(new FileOperationEvent(source, mode === 'copy' ? 3 /* FileOperation.COPY */ : 2 /* FileOperation.MOVE */, fileStat));
|
|
787
783
|
return fileStat;
|
|
788
784
|
}
|
|
789
785
|
async doMoveCopy(sourceProvider, source, targetProvider, target, mode, overwrite) {
|
|
@@ -796,7 +792,7 @@ let FileService = class FileService {
|
|
|
796
792
|
if (exists && !overwrite) {
|
|
797
793
|
const parent = await this.resolve(target.parent);
|
|
798
794
|
const targetFileStat = await this.resolve(target);
|
|
799
|
-
target =
|
|
795
|
+
target = FileSystemUtils.generateUniqueResourceURI(parent, target, targetFileStat.isDirectory, isSameResourceWithDifferentPathCase ? 'copy' : undefined);
|
|
800
796
|
}
|
|
801
797
|
// delete as needed (unless target is same resource with different path case)
|
|
802
798
|
if (exists && !isSameResourceWithDifferentPathCase && overwrite) {
|
|
@@ -807,7 +803,7 @@ let FileService = class FileService {
|
|
|
807
803
|
// copy source => target
|
|
808
804
|
if (mode === 'copy') {
|
|
809
805
|
// same provider with fast copy: leverage copy() functionality
|
|
810
|
-
if (sourceProvider === targetProvider &&
|
|
806
|
+
if (sourceProvider === targetProvider && hasFileFolderCopyCapability(sourceProvider)) {
|
|
811
807
|
await sourceProvider.copy(source, target, { overwrite });
|
|
812
808
|
}
|
|
813
809
|
// when copying via buffer/unbuffered, we have to manually
|
|
@@ -840,19 +836,19 @@ let FileService = class FileService {
|
|
|
840
836
|
}
|
|
841
837
|
async doCopyFile(sourceProvider, source, targetProvider, target) {
|
|
842
838
|
// copy: source (buffered) => target (buffered)
|
|
843
|
-
if (
|
|
839
|
+
if (hasOpenReadWriteCloseCapability(sourceProvider) && hasOpenReadWriteCloseCapability(targetProvider)) {
|
|
844
840
|
return this.doPipeBuffered(sourceProvider, source, targetProvider, target);
|
|
845
841
|
}
|
|
846
842
|
// copy: source (buffered) => target (unbuffered)
|
|
847
|
-
if (
|
|
843
|
+
if (hasOpenReadWriteCloseCapability(sourceProvider) && hasReadWriteCapability(targetProvider)) {
|
|
848
844
|
return this.doPipeBufferedToUnbuffered(sourceProvider, source, targetProvider, target);
|
|
849
845
|
}
|
|
850
846
|
// copy: source (unbuffered) => target (buffered)
|
|
851
|
-
if (
|
|
847
|
+
if (hasReadWriteCapability(sourceProvider) && hasOpenReadWriteCloseCapability(targetProvider)) {
|
|
852
848
|
return this.doPipeUnbufferedToBuffered(sourceProvider, source, targetProvider, target);
|
|
853
849
|
}
|
|
854
850
|
// copy: source (unbuffered) => target (unbuffered)
|
|
855
|
-
if (
|
|
851
|
+
if (hasReadWriteCapability(sourceProvider) && hasReadWriteCapability(targetProvider)) {
|
|
856
852
|
return this.doPipeUnbuffered(sourceProvider, source, targetProvider, target);
|
|
857
853
|
}
|
|
858
854
|
}
|
|
@@ -881,10 +877,10 @@ let FileService = class FileService {
|
|
|
881
877
|
isSameResourceWithDifferentPathCase = source.toString().toLowerCase() === target.toString().toLowerCase();
|
|
882
878
|
}
|
|
883
879
|
if (isSameResourceWithDifferentPathCase && mode === 'copy') {
|
|
884
|
-
throw new Error(
|
|
880
|
+
throw new Error(nls.localizeByDefault("Unable to move/copy when source '{0}' is parent of target '{1}'.", this.resourceForError(source), this.resourceForError(target)));
|
|
885
881
|
}
|
|
886
882
|
if (!isSameResourceWithDifferentPathCase && source.isEqualOrParent(target, isPathCaseSensitive)) {
|
|
887
|
-
throw new Error(
|
|
883
|
+
throw new Error(nls.localizeByDefault("Unable to move/copy when source '{0}' is parent of target '{1}'.", this.resourceForError(source), this.resourceForError(target)));
|
|
888
884
|
}
|
|
889
885
|
}
|
|
890
886
|
// Extra checks if target exists and this is not a rename
|
|
@@ -895,7 +891,7 @@ let FileService = class FileService {
|
|
|
895
891
|
if (sourceProvider === targetProvider) {
|
|
896
892
|
const isPathCaseSensitive = !!(sourceProvider.capabilities & 1024 /* FileSystemProviderCapabilities.PathCaseSensitive */);
|
|
897
893
|
if (target.isEqualOrParent(source, isPathCaseSensitive)) {
|
|
898
|
-
throw new Error(
|
|
894
|
+
throw new Error(nls.localizeByDefault("Unable to move/copy '{0}' into '{1}' since a file would replace the folder it is contained in.", this.resourceForError(source), this.resourceForError(target)));
|
|
899
895
|
}
|
|
900
896
|
}
|
|
901
897
|
}
|
|
@@ -912,7 +908,7 @@ let FileService = class FileService {
|
|
|
912
908
|
this.onDidRunUserOperationEmitter.fire({ correlationId: this.correlationIds++, operation: 0 /* FileOperation.CREATE */, target: resource });
|
|
913
909
|
}
|
|
914
910
|
else {
|
|
915
|
-
this.onDidRunOperationEmitter.fire(new
|
|
911
|
+
this.onDidRunOperationEmitter.fire(new FileOperationEvent(resource, 0 /* FileOperation.CREATE */, fileStat));
|
|
916
912
|
}
|
|
917
913
|
return fileStat;
|
|
918
914
|
}
|
|
@@ -922,14 +918,14 @@ let FileService = class FileService {
|
|
|
922
918
|
while (!directory.path.isRoot) {
|
|
923
919
|
try {
|
|
924
920
|
const stat = await provider.stat(directory);
|
|
925
|
-
if ((stat.type &
|
|
926
|
-
throw new Error(
|
|
921
|
+
if ((stat.type & FileType.Directory) === 0) {
|
|
922
|
+
throw new Error(nls.localizeByDefault("Unable to create folder '{0}' that already exists but is not a directory", this.resourceForError(directory)));
|
|
927
923
|
}
|
|
928
924
|
break; // we have hit a directory that exists -> good
|
|
929
925
|
}
|
|
930
926
|
catch (error) {
|
|
931
927
|
// Bubble up any other error that is not file not found
|
|
932
|
-
if (
|
|
928
|
+
if (toFileSystemProviderErrorCode(error) !== FileSystemProviderErrorCode.FileNotFound) {
|
|
933
929
|
throw error;
|
|
934
930
|
}
|
|
935
931
|
// Upon error, remember directories that need to be created
|
|
@@ -945,7 +941,7 @@ let FileService = class FileService {
|
|
|
945
941
|
await provider.mkdir(directory);
|
|
946
942
|
}
|
|
947
943
|
catch (error) {
|
|
948
|
-
if (
|
|
944
|
+
if (toFileSystemProviderErrorCode(error) !== FileSystemProviderErrorCode.FileExists) {
|
|
949
945
|
// For mkdirp() we tolerate that the mkdir() call fails
|
|
950
946
|
// in case the folder already exists. This follows node.js
|
|
951
947
|
// own implementation of fs.mkdir({ recursive: true }) and
|
|
@@ -980,25 +976,25 @@ let FileService = class FileService {
|
|
|
980
976
|
// Validate trash support
|
|
981
977
|
const useTrash = !!options?.useTrash;
|
|
982
978
|
if (useTrash && !(provider.capabilities & 4096 /* FileSystemProviderCapabilities.Trash */)) {
|
|
983
|
-
throw new Error(
|
|
979
|
+
throw new Error(nls.localizeByDefault("Unable to delete file '{0}' via trash because provider does not support it.", this.resourceForError(resource)));
|
|
984
980
|
}
|
|
985
981
|
// Validate delete
|
|
986
982
|
const exists = await this.exists(resource);
|
|
987
983
|
if (!exists) {
|
|
988
|
-
throw new
|
|
984
|
+
throw new FileOperationError(nls.localizeByDefault("Unable to delete nonexistent file '{0}'", this.resourceForError(resource)), 1 /* FileOperationResult.FILE_NOT_FOUND */);
|
|
989
985
|
}
|
|
990
986
|
// Validate recursive
|
|
991
987
|
const recursive = !!options?.recursive;
|
|
992
988
|
if (!recursive && exists) {
|
|
993
989
|
const stat = await this.resolve(resource);
|
|
994
990
|
if (stat.isDirectory && Array.isArray(stat.children) && stat.children.length > 0) {
|
|
995
|
-
throw new Error(
|
|
991
|
+
throw new Error(nls.localizeByDefault("Unable to delete non-empty folder '{0}'.", this.resourceForError(resource)));
|
|
996
992
|
}
|
|
997
993
|
}
|
|
998
994
|
// Delete through provider
|
|
999
995
|
await provider.delete(resource, { recursive, useTrash });
|
|
1000
996
|
// Events
|
|
1001
|
-
this.onDidRunOperationEmitter.fire(new
|
|
997
|
+
this.onDidRunOperationEmitter.fire(new FileOperationEvent(resource, 1 /* FileOperation.DELETE */));
|
|
1002
998
|
}
|
|
1003
999
|
/**
|
|
1004
1000
|
* An event that is emitted when files are changed on the disk.
|
|
@@ -1012,7 +1008,7 @@ let FileService = class FileService {
|
|
|
1012
1008
|
excludes: this.resolveWatcherExcludes(resource, options.excludes)
|
|
1013
1009
|
};
|
|
1014
1010
|
let watchDisposed = false;
|
|
1015
|
-
let watchDisposable =
|
|
1011
|
+
let watchDisposable = Disposable.create(() => watchDisposed = true);
|
|
1016
1012
|
// Watch and wire in disposable which is async but
|
|
1017
1013
|
// check if we got disposed meanwhile and forward
|
|
1018
1014
|
this.doWatch(resource, resolvedOptions).then(disposable => {
|
|
@@ -1023,7 +1019,7 @@ let FileService = class FileService {
|
|
|
1023
1019
|
watchDisposable = disposable;
|
|
1024
1020
|
}
|
|
1025
1021
|
}, error => this.logger.error(error));
|
|
1026
|
-
return
|
|
1022
|
+
return Disposable.create(() => watchDisposable.dispose());
|
|
1027
1023
|
}
|
|
1028
1024
|
/**
|
|
1029
1025
|
* Resolve the effective exclude globs for a watcher: the caller-supplied `excludes`, the
|
|
@@ -1088,7 +1084,7 @@ let FileService = class FileService {
|
|
|
1088
1084
|
realWatcher,
|
|
1089
1085
|
subsumingParent: undefined,
|
|
1090
1086
|
subsumedChildren: new Set(),
|
|
1091
|
-
compiledExcludes: options.excludes.map(pattern => new
|
|
1087
|
+
compiledExcludes: options.excludes.map(pattern => new Minimatch(pattern, { dot: true })),
|
|
1092
1088
|
};
|
|
1093
1089
|
return recursiveEntry;
|
|
1094
1090
|
}
|
|
@@ -1100,7 +1096,7 @@ let FileService = class FileService {
|
|
|
1100
1096
|
};
|
|
1101
1097
|
}
|
|
1102
1098
|
createWatcherDisposable(key, entry) {
|
|
1103
|
-
return
|
|
1099
|
+
return Disposable.create(() => {
|
|
1104
1100
|
entry.count--;
|
|
1105
1101
|
if (entry.count === 0) {
|
|
1106
1102
|
this.disposeWatcherEntry(key, entry);
|
|
@@ -1292,7 +1288,7 @@ let FileService = class FileService {
|
|
|
1292
1288
|
let tree = this.recursiveWatcherIndexes.get(provider);
|
|
1293
1289
|
if (!tree) {
|
|
1294
1290
|
const caseSensitive = !!(provider.capabilities & 1024 /* FileSystemProviderCapabilities.PathCaseSensitive */);
|
|
1295
|
-
tree =
|
|
1291
|
+
tree = TernarySearchTree.forUris(caseSensitive);
|
|
1296
1292
|
this.recursiveWatcherIndexes.set(provider, tree);
|
|
1297
1293
|
}
|
|
1298
1294
|
return tree;
|
|
@@ -1334,7 +1330,7 @@ let FileService = class FileService {
|
|
|
1334
1330
|
const handle = await provider.open(resource, { create: true });
|
|
1335
1331
|
// write into handle until all bytes from buffer have been written
|
|
1336
1332
|
try {
|
|
1337
|
-
if (
|
|
1333
|
+
if (isReadableStream(readableOrStreamOrBufferedStream) || isReadableBufferedStream(readableOrStreamOrBufferedStream)) {
|
|
1338
1334
|
await this.doWriteStreamBufferedQueued(provider, handle, readableOrStreamOrBufferedStream);
|
|
1339
1335
|
}
|
|
1340
1336
|
else {
|
|
@@ -1342,7 +1338,7 @@ let FileService = class FileService {
|
|
|
1342
1338
|
}
|
|
1343
1339
|
}
|
|
1344
1340
|
catch (error) {
|
|
1345
|
-
throw
|
|
1341
|
+
throw ensureFileSystemProviderError(error);
|
|
1346
1342
|
}
|
|
1347
1343
|
finally {
|
|
1348
1344
|
// close handle always
|
|
@@ -1355,9 +1351,9 @@ let FileService = class FileService {
|
|
|
1355
1351
|
let stream;
|
|
1356
1352
|
// Buffered stream: consume the buffer first by writing
|
|
1357
1353
|
// it to the target before reading from the stream.
|
|
1358
|
-
if (
|
|
1354
|
+
if (isReadableBufferedStream(streamOrBufferedStream)) {
|
|
1359
1355
|
if (streamOrBufferedStream.buffer.length > 0) {
|
|
1360
|
-
const chunk =
|
|
1356
|
+
const chunk = BinaryBuffer.concat(streamOrBufferedStream.buffer);
|
|
1361
1357
|
await this.doWriteBuffer(provider, handle, chunk, chunk.byteLength, posInFile, 0);
|
|
1362
1358
|
posInFile += chunk.byteLength;
|
|
1363
1359
|
}
|
|
@@ -1412,17 +1408,17 @@ let FileService = class FileService {
|
|
|
1412
1408
|
}
|
|
1413
1409
|
async doWriteUnbufferedQueued(provider, resource, bufferOrReadableOrStreamOrBufferedStream) {
|
|
1414
1410
|
let buffer;
|
|
1415
|
-
if (bufferOrReadableOrStreamOrBufferedStream instanceof
|
|
1411
|
+
if (bufferOrReadableOrStreamOrBufferedStream instanceof BinaryBuffer) {
|
|
1416
1412
|
buffer = bufferOrReadableOrStreamOrBufferedStream;
|
|
1417
1413
|
}
|
|
1418
|
-
else if (
|
|
1419
|
-
buffer = await
|
|
1414
|
+
else if (isReadableStream(bufferOrReadableOrStreamOrBufferedStream)) {
|
|
1415
|
+
buffer = await BinaryBufferReadableStream.toBuffer(bufferOrReadableOrStreamOrBufferedStream);
|
|
1420
1416
|
}
|
|
1421
|
-
else if (
|
|
1422
|
-
buffer = await
|
|
1417
|
+
else if (isReadableBufferedStream(bufferOrReadableOrStreamOrBufferedStream)) {
|
|
1418
|
+
buffer = await BinaryBufferReadableBufferedStream.toBuffer(bufferOrReadableOrStreamOrBufferedStream);
|
|
1423
1419
|
}
|
|
1424
1420
|
else {
|
|
1425
|
-
buffer =
|
|
1421
|
+
buffer = BinaryBufferReadable.toBuffer(bufferOrReadableOrStreamOrBufferedStream);
|
|
1426
1422
|
}
|
|
1427
1423
|
return provider.writeFile(resource, buffer.buffer, { create: true, overwrite: true });
|
|
1428
1424
|
}
|
|
@@ -1436,7 +1432,7 @@ let FileService = class FileService {
|
|
|
1436
1432
|
// Open handles
|
|
1437
1433
|
sourceHandle = await sourceProvider.open(source, { create: false });
|
|
1438
1434
|
targetHandle = await targetProvider.open(target, { create: true });
|
|
1439
|
-
const buffer =
|
|
1435
|
+
const buffer = BinaryBuffer.alloc(this.BUFFER_SIZE);
|
|
1440
1436
|
let posInFile = 0;
|
|
1441
1437
|
let posInBuffer = 0;
|
|
1442
1438
|
let bytesRead = 0;
|
|
@@ -1456,7 +1452,7 @@ let FileService = class FileService {
|
|
|
1456
1452
|
} while (bytesRead > 0);
|
|
1457
1453
|
}
|
|
1458
1454
|
catch (error) {
|
|
1459
|
-
throw
|
|
1455
|
+
throw ensureFileSystemProviderError(error);
|
|
1460
1456
|
}
|
|
1461
1457
|
finally {
|
|
1462
1458
|
await Promise.all([
|
|
@@ -1480,10 +1476,10 @@ let FileService = class FileService {
|
|
|
1480
1476
|
// Read entire buffer from source and write buffered
|
|
1481
1477
|
try {
|
|
1482
1478
|
const buffer = await sourceProvider.readFile(source);
|
|
1483
|
-
await this.doWriteBuffer(targetProvider, targetHandle,
|
|
1479
|
+
await this.doWriteBuffer(targetProvider, targetHandle, BinaryBuffer.wrap(buffer), buffer.byteLength, 0, 0);
|
|
1484
1480
|
}
|
|
1485
1481
|
catch (error) {
|
|
1486
|
-
throw
|
|
1482
|
+
throw ensureFileSystemProviderError(error);
|
|
1487
1483
|
}
|
|
1488
1484
|
finally {
|
|
1489
1485
|
await targetProvider.close(targetHandle);
|
|
@@ -1491,13 +1487,13 @@ let FileService = class FileService {
|
|
|
1491
1487
|
}
|
|
1492
1488
|
async doPipeBufferedToUnbuffered(sourceProvider, source, targetProvider, target) {
|
|
1493
1489
|
// Read buffer via stream buffered
|
|
1494
|
-
const buffer = await
|
|
1490
|
+
const buffer = await BinaryBufferReadableStream.toBuffer(this.readFileBuffered(sourceProvider, source, CancellationToken.None));
|
|
1495
1491
|
// Write buffer into target at once
|
|
1496
1492
|
await this.doWriteUnbuffered(targetProvider, target, buffer);
|
|
1497
1493
|
}
|
|
1498
1494
|
throwIfFileSystemIsReadonly(provider, resource) {
|
|
1499
1495
|
if (provider.capabilities & 2048 /* FileSystemProviderCapabilities.Readonly */) {
|
|
1500
|
-
throw new
|
|
1496
|
+
throw new FileOperationError(nls.localizeByDefault("Unable to modify read-only file '{0}'", this.resourceForError(resource)), 6 /* FileOperationResult.FILE_PERMISSION_DENIED */);
|
|
1501
1497
|
}
|
|
1502
1498
|
return provider;
|
|
1503
1499
|
}
|
|
@@ -1506,7 +1502,7 @@ let FileService = class FileService {
|
|
|
1506
1502
|
}
|
|
1507
1503
|
addFileOperationParticipant(participant) {
|
|
1508
1504
|
this.participants.push(participant);
|
|
1509
|
-
return
|
|
1505
|
+
return Disposable.create(() => {
|
|
1510
1506
|
const index = this.participants.indexOf(participant);
|
|
1511
1507
|
if (index > -1) {
|
|
1512
1508
|
this.participants.splice(index, 1);
|
|
@@ -1518,7 +1514,7 @@ let FileService = class FileService {
|
|
|
1518
1514
|
if (participantsTimeout <= 0 || this.participants.length === 0) {
|
|
1519
1515
|
return;
|
|
1520
1516
|
}
|
|
1521
|
-
const cancellationTokenSource = new
|
|
1517
|
+
const cancellationTokenSource = new CancellationTokenSource();
|
|
1522
1518
|
return this.progressService.withProgress(this.progressLabel(operation), 'notification', async () => {
|
|
1523
1519
|
for (const participant of this.participants) {
|
|
1524
1520
|
if (cancellationTokenSource.token.isCancellationRequested) {
|
|
@@ -1528,7 +1524,7 @@ let FileService = class FileService {
|
|
|
1528
1524
|
const promise = participant.participate(target, source, operation, participantsTimeout, cancellationTokenSource.token);
|
|
1529
1525
|
await Promise.race([
|
|
1530
1526
|
promise,
|
|
1531
|
-
|
|
1527
|
+
timeout(participantsTimeout, cancellationTokenSource.token).then(() => cancellationTokenSource.dispose(), () => { })
|
|
1532
1528
|
]);
|
|
1533
1529
|
}
|
|
1534
1530
|
catch (err) {
|
|
@@ -1542,13 +1538,13 @@ let FileService = class FileService {
|
|
|
1542
1538
|
progressLabel(operation) {
|
|
1543
1539
|
switch (operation) {
|
|
1544
1540
|
case 0 /* FileOperation.CREATE */:
|
|
1545
|
-
return
|
|
1541
|
+
return nls.localizeByDefault("Running 'File Create' participants...");
|
|
1546
1542
|
case 2 /* FileOperation.MOVE */:
|
|
1547
|
-
return
|
|
1543
|
+
return nls.localizeByDefault("Running 'File Rename' participants...");
|
|
1548
1544
|
case 3 /* FileOperation.COPY */:
|
|
1549
|
-
return
|
|
1545
|
+
return nls.localizeByDefault("Running 'File Copy' participants...");
|
|
1550
1546
|
case 1 /* FileOperation.DELETE */:
|
|
1551
|
-
return
|
|
1547
|
+
return nls.localizeByDefault("Running 'File Delete' participants...");
|
|
1552
1548
|
}
|
|
1553
1549
|
}
|
|
1554
1550
|
// #endregion
|
|
@@ -1558,7 +1554,7 @@ let FileService = class FileService {
|
|
|
1558
1554
|
return this.encodingService.toResourceEncoding(encoding, {
|
|
1559
1555
|
overwriteEncoding: options?.overwriteEncoding,
|
|
1560
1556
|
read: async (length) => {
|
|
1561
|
-
const buffer = await
|
|
1557
|
+
const buffer = await BinaryBufferReadableStream.toBuffer((await this.readFileStream(resource, { length })).value);
|
|
1562
1558
|
return buffer.buffer;
|
|
1563
1559
|
}
|
|
1564
1560
|
});
|
|
@@ -1567,8 +1563,8 @@ let FileService = class FileService {
|
|
|
1567
1563
|
let preferredEncoding;
|
|
1568
1564
|
// Encoding passed in as option
|
|
1569
1565
|
if (options?.encoding) {
|
|
1570
|
-
if (detectedEncoding ===
|
|
1571
|
-
preferredEncoding =
|
|
1566
|
+
if (detectedEncoding === UTF8_with_bom && options.encoding === UTF8) {
|
|
1567
|
+
preferredEncoding = UTF8_with_bom; // indicate the file has BOM if we are to resolve with UTF 8
|
|
1572
1568
|
}
|
|
1573
1569
|
else {
|
|
1574
1570
|
preferredEncoding = options.encoding; // give passed in encoding highest priority
|
|
@@ -1577,8 +1573,8 @@ let FileService = class FileService {
|
|
|
1577
1573
|
else if (detectedEncoding) {
|
|
1578
1574
|
preferredEncoding = detectedEncoding;
|
|
1579
1575
|
}
|
|
1580
|
-
else if (this.preferences.get('files.encoding', undefined, resource.toString()) ===
|
|
1581
|
-
preferredEncoding =
|
|
1576
|
+
else if (this.preferences.get('files.encoding', undefined, resource.toString()) === UTF8_with_bom) {
|
|
1577
|
+
preferredEncoding = UTF8; // if we did not detect UTF 8 BOM before, this can only be UTF 8 then
|
|
1582
1578
|
}
|
|
1583
1579
|
return this.getEncodingForResource(resource, preferredEncoding);
|
|
1584
1580
|
}
|
|
@@ -1594,7 +1590,7 @@ let FileService = class FileService {
|
|
|
1594
1590
|
*/
|
|
1595
1591
|
async toUnderlyingResource(resource) {
|
|
1596
1592
|
let provider = await this.withProvider(resource);
|
|
1597
|
-
while (provider instanceof
|
|
1593
|
+
while (provider instanceof DelegatingFileSystemProvider) {
|
|
1598
1594
|
resource = provider.toUnderlyingResource(resource);
|
|
1599
1595
|
provider = await this.withProvider(resource);
|
|
1600
1596
|
}
|
|
@@ -1605,48 +1601,37 @@ let FileService = class FileService {
|
|
|
1605
1601
|
this.watcherErrorHandler.handleError();
|
|
1606
1602
|
}
|
|
1607
1603
|
};
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
(0, inversify_1.inject)(label_provider_1.LabelProvider),
|
|
1611
|
-
tslib_1.__metadata("design:type", label_provider_1.LabelProvider)
|
|
1604
|
+
__decorate([
|
|
1605
|
+
inject(LabelProvider)
|
|
1612
1606
|
], FileService.prototype, "labelProvider", void 0);
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
tslib_1.__metadata("design:type", Object)
|
|
1607
|
+
__decorate([
|
|
1608
|
+
inject(FileSystemPreferences)
|
|
1616
1609
|
], FileService.prototype, "preferences", void 0);
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
tslib_1.__metadata("design:type", progress_service_1.ProgressService)
|
|
1610
|
+
__decorate([
|
|
1611
|
+
inject(ProgressService)
|
|
1620
1612
|
], FileService.prototype, "progressService", void 0);
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
tslib_1.__metadata("design:type", encoding_registry_1.EncodingRegistry)
|
|
1613
|
+
__decorate([
|
|
1614
|
+
inject(EncodingRegistry)
|
|
1624
1615
|
], FileService.prototype, "encodingRegistry", void 0);
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
tslib_1.__metadata("design:type", encoding_service_1.EncodingService)
|
|
1616
|
+
__decorate([
|
|
1617
|
+
inject(EncodingService)
|
|
1628
1618
|
], FileService.prototype, "encodingService", void 0);
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
tslib_1.__metadata("design:type", Object)
|
|
1619
|
+
__decorate([
|
|
1620
|
+
inject(ContributionProvider),
|
|
1621
|
+
named(FileServiceContribution)
|
|
1633
1622
|
], FileService.prototype, "contributions", void 0);
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
tslib_1.__metadata("design:type", filesystem_watcher_error_handler_1.FileSystemWatcherErrorHandler)
|
|
1623
|
+
__decorate([
|
|
1624
|
+
inject(FileSystemWatcherErrorHandler)
|
|
1637
1625
|
], FileService.prototype, "watcherErrorHandler", void 0);
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
tslib_1.__metadata("design:type", Object)
|
|
1626
|
+
__decorate([
|
|
1627
|
+
inject(ILogger),
|
|
1628
|
+
named('filesystem:FileService')
|
|
1642
1629
|
], FileService.prototype, "logger", void 0);
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
tslib_1.__metadata("design:type", Function),
|
|
1646
|
-
tslib_1.__metadata("design:paramtypes", []),
|
|
1647
|
-
tslib_1.__metadata("design:returntype", void 0)
|
|
1630
|
+
__decorate([
|
|
1631
|
+
postConstruct()
|
|
1648
1632
|
], FileService.prototype, "init", null);
|
|
1649
|
-
|
|
1650
|
-
|
|
1633
|
+
FileService = __decorate([
|
|
1634
|
+
injectable()
|
|
1651
1635
|
], FileService);
|
|
1636
|
+
export { FileService };
|
|
1652
1637
|
//# sourceMappingURL=file-service.js.map
|