1
1
// Copyright © 2024, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
2
2
// SPDX-License-Identifier: Apache-2.0
3
- import { FileType , Uri , l10n } from "vscode" ;
3
+ import { FileType , Uri } from "vscode" ;
4
4
5
5
import { AxiosResponse } from "axios" ;
6
6
@@ -48,13 +48,15 @@ class RestServerAdapter implements ContentAdapter {
48
48
private fileMetadataMap : {
49
49
[ id : string ] : { etag : string ; lastModified ?: string ; contentType ?: string } ;
50
50
} ;
51
+ private fileNavigationSetByAdmin : boolean ;
51
52
52
53
public constructor (
53
54
protected fileNavigationCustomRootPath : ProfileWithFileRootOptions [ "fileNavigationCustomRootPath" ] ,
54
55
protected fileNavigationRoot : ProfileWithFileRootOptions [ "fileNavigationRoot" ] ,
55
56
) {
56
57
this . rootFolders = { } ;
57
58
this . fileMetadataMap = { } ;
59
+ this . fileNavigationSetByAdmin = false ;
58
60
}
59
61
60
62
addChildItem : (
@@ -75,9 +77,11 @@ class RestServerAdapter implements ContentAdapter {
75
77
if ( session . contextAttributes ) {
76
78
const attributes = await session . contextAttributes ( ) ;
77
79
if (
78
- attributes . fileNavigationCustomRootPath ||
79
- attributes . fileNavigationRoot
80
+ attributes &&
81
+ ( attributes . fileNavigationCustomRootPath ||
82
+ attributes . fileNavigationRoot )
80
83
) {
84
+ this . fileNavigationSetByAdmin = true ;
81
85
this . fileNavigationCustomRootPath =
82
86
attributes . fileNavigationCustomRootPath ?? "" ;
83
87
this . fileNavigationRoot = attributes . fileNavigationRoot ?? "USER" ;
@@ -260,11 +264,11 @@ class RestServerAdapter implements ContentAdapter {
260
264
parentItem . uri === SAS_SERVER_HOME_DIRECTORY &&
261
265
this . fileNavigationRoot === "CUSTOM"
262
266
) {
263
- throw new Error (
264
- l10n . t ( Messages . FileNavigationRootError , {
265
- path : this . fileNavigationCustomRootPath ,
266
- } ) ,
267
- ) ;
267
+ if ( this . fileNavigationSetByAdmin ) {
268
+ throw new Error ( Messages . FileNavigationRootAdminError ) ;
269
+ } else {
270
+ throw new Error ( Messages . FileNavigationRootUserError ) ;
271
+ }
268
272
}
269
273
throw error ;
270
274
}
0 commit comments