fileService.ts ×7

Frontier kind: Code frontier

unlabeled · c_6b2fab97e0c0

10 tests · 13837 LOC · 56 files · introduces 0 tests · 30 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
7 ranges30 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
2160 ranges13837 lines · 56 files · Browse complete extent
All tests (intent)
10 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

1 file ranked by introduced lines: 30 introduced LOC across 7 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/files/common/fileService.ts 30 introduced LOC · 7 ranges

Open complete file

788
789 async move(source: URI, target: URI, overwrite?: boolean): Promise<IFileStatWithMetadata> {
790 > const sourceProvider = this.throwIfFileSystemIsReadonly(await this.withWriteProvider(source), source); fileService.ts
791 > const targetProvider = this.throwIfFileSystemIsReadonly(await this.withWriteProvider(target), target);
792 >
793 > // move
794 > const mode = await this.doMoveCopy(sourceProvider, source, targetProvider, target, 'move', !!overwrite);
795 >
796 > // resolve and send events
797 > const fileStat = await this.resolve(target, { resolveMetadata: true });
798 > this._onDidRunOperation.fire(new FileOperationEvent(source, mode === 'move' ? FileOperation.MOVE : FileOperation.COPY, fileStat));
799 >
800 > return fileStat;
801 > }
802
803 async copy(source: URI, target: URI, overwrite?: boolean): Promise<IFileStatWithMetadata> {
852 return mode;
853 }
855 > // move source => target
856 > else {
857 >
858 > // same provider: leverage rename() functionality
859 > if (sourceProvider === targetProvider) {
860 > await sourceProvider.rename(source, target, { overwrite });
861 >
862 > return mode;
863 > }
864
865 // across providers: copy to target & delete at source
919 // Check if source is equal or parent to target (requires providers to be the same)
920 if (sourceProvider === targetProvider) {
921 > const { providerExtUri, isPathCaseSensitive } = this.getExtUri(sourceProvider); fileService.ts
922 > if (!isPathCaseSensitive) {
923 isSameResourceWithDifferentPathCase = providerExtUri.isEqual(source, target);
924 }
926 > if (isSameResourceWithDifferentPathCase && mode === 'copy') {
927 throw new Error(localize('unableToMoveCopyError1', "Unable to copy when source '{0}' is same as target '{1}' with different path case on a case insensitive file system", this.resourceForError(source), this.resourceForError(target)));
928 }
930 > if (!isSameResourceWithDifferentPathCase && providerExtUri.isEqualOrParent(target, source)) {
931 throw new Error(localize('unableToMoveCopyError2', "Unable to move/copy when source '{0}' is parent of target '{1}'.", this.resourceForError(source), this.resourceForError(target)));
932 }
933 > } fileService.ts
934
935 // Extra checks if target exists and this is not a rename