@@ -180,31 +180,34 @@ export class QSysFS implements vscode.FileSystemProvider {
180180 const path = uri . path ;
181181 const connection = instance . getConnection ( ) ;
182182 if ( connection ) {
183- const contentApi = connection . getContent ( ) ;
184- let { asp, library, file, name : member , extension } = this . parseMemberPath ( connection , uri . path ) ;
185- asp = asp || await connection . lookupLibraryIAsp ( library ) ;
183+ const readonly = connection . getConfig ( ) . readOnlyMode ;
184+ if ( readonly ) {
185+ throw new FileSystemError ( "Connection is in readonly mode" ) ;
186+ }
187+ const contentApi = connection . getContent ( ) ;
188+ let { asp, library, file, name : member , extension } = this . parseMemberPath ( connection , uri . path ) ;
189+ asp = asp || ( await connection . lookupLibraryIAsp ( library ) ) ;
186190
187- if ( ! content . length ) { //Coming from "Save as"
188- const addMember = await connection . runCommand ( {
189- command : `ADDPFM FILE(${ library } /${ file } ) MBR(${ member } ) SRCTYPE(${ extension || '*NONE' } )` ,
190- noLibList : true
191- } ) ;
192- if ( addMember . code === 0 ) {
193- this . savedAsMembers . add ( uri . path ) ;
194- vscode . commands . executeCommand ( `code-for-ibmi.refreshObjectBrowser` ) ;
195- } else {
196- throw new FileSystemError ( addMember . stderr ) ;
197- }
198- }
199- else {
200- this . savedAsMembers . delete ( uri . path ) ;
201- this . extendedMemberSupport ?
202- await this . extendedContent . uploadMemberContentWithDates ( uri , content . toString ( ) ) :
203- await contentApi . uploadMemberContent ( library , file , member , content ) ;
191+ if ( ! content . length ) {
192+ //Coming from "Save as"
193+ const addMember = await connection . runCommand ( {
194+ command : `ADDPFM FILE(${ library } /${ file } ) MBR(${ member } ) SRCTYPE(${ extension || "*NONE" } )` ,
195+ noLibList : true ,
196+ } ) ;
197+ if ( addMember . code === 0 ) {
198+ this . savedAsMembers . add ( uri . path ) ;
199+ vscode . commands . executeCommand ( `code-for-ibmi.refreshObjectBrowser` ) ;
200+ } else {
201+ throw new FileSystemError ( addMember . stderr ) ;
204202 }
205- }
206- else {
207- throw new FileSystemError ( "Not connected to IBM i" ) ;
203+ } else {
204+ this . savedAsMembers . delete ( uri . path ) ;
205+ this . extendedMemberSupport
206+ ? await this . extendedContent . uploadMemberContentWithDates ( uri , content . toString ( ) )
207+ : await contentApi . uploadMemberContent ( library , file , member , content ) ;
208+ }
209+ } else {
210+ throw new FileSystemError ( "Not connected to IBM i" ) ;
208211 }
209212 }
210213
0 commit comments