Skip to content

Commit 0cf05f3

Browse files
committed
Fetch ASP at time of read/write
Signed-off-by: worksofliam <[email protected]>
1 parent 0068818 commit 0cf05f3

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

src/api/IBMi.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1228,7 +1228,7 @@ export default class IBMi {
12281228
if (!foundNumber) {
12291229
const [row] = await this.runSQL(`SELECT IASP_NUMBER FROM TABLE(QSYS2.LIBRARY_INFO('${this.sysNameInAmerican(library)}'))`);
12301230
const iaspNumber = Number(row?.IASP_NUMBER);
1231-
if (iaspNumber) {
1231+
if (iaspNumber >= 0) {
12321232
this.libraryAsps[library] = iaspNumber;
12331233
foundNumber = iaspNumber;
12341234
}
@@ -1239,7 +1239,7 @@ export default class IBMi {
12391239

12401240
getLibraryIAsp(library: string) {
12411241
const found = this.libraryAsps[library];
1242-
if (found) {
1242+
if (found >= 0) {
12431243
return this.getIAspName(found);
12441244
}
12451245
}

src/api/IBMiContent.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ export default class IBMiContent {
142142
* Download the contents of a source member
143143
*/
144144
async downloadMemberContent(asp: string | undefined, library: string, sourceFile: string, member: string, localPath?: string) {
145-
asp = asp || this.ibmi.getCurrentIAspName();
146145
library = this.ibmi.upperCaseName(library);
147146
sourceFile = this.ibmi.upperCaseName(sourceFile);
148147
member = this.ibmi.upperCaseName(member);
@@ -210,7 +209,6 @@ export default class IBMiContent {
210209
* Upload to a member
211210
*/
212211
async uploadMemberContent(asp: string | undefined, library: string, sourceFile: string, member: string, content: string | Uint8Array) {
213-
asp = asp || this.ibmi.getCurrentIAspName();
214212
library = this.ibmi.upperCaseName(library);
215213
sourceFile = this.ibmi.upperCaseName(sourceFile);
216214
member = this.ibmi.upperCaseName(member);

src/filesystems/qsys/QSysFs.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,8 @@ export class QSysFS implements vscode.FileSystemProvider {
148148
const contentApi = instance.getContent();
149149
const connection = instance.getConnection();
150150
if (connection && contentApi) {
151-
const { asp, library, file, name: member } = this.parseMemberPath(connection, uri.path);
151+
let { asp, library, file, name: member } = this.parseMemberPath(connection, uri.path);
152+
asp = asp || await connection.lookupLibraryIAsp(library);
152153

153154
let memberContent;
154155
try {
@@ -189,7 +190,9 @@ export class QSysFS implements vscode.FileSystemProvider {
189190
const contentApi = instance.getContent();
190191
const connection = instance.getConnection();
191192
if (connection && contentApi) {
192-
const { asp, library, file, name: member, extension } = this.parseMemberPath(connection, uri.path);
193+
let { asp, library, file, name: member, extension } = this.parseMemberPath(connection, uri.path);
194+
asp = asp || await connection.lookupLibraryIAsp(library);
195+
193196
if (!content.length) { //Coming from "Save as"
194197
const addMember = await connection.runCommand({
195198
command: `ADDPFM FILE(${library}/${file}) MBR(${member}) SRCTYPE(${extension || '*NONE'})`,
@@ -202,6 +205,7 @@ export class QSysFS implements vscode.FileSystemProvider {
202205
throw new FileSystemError(addMember.stderr);
203206
}
204207
}
208+
205209
else {
206210
this.savedAsMembers.delete(uri.path);
207211
this.extendedMemberSupport ?

0 commit comments

Comments
 (0)