diff --git a/bin/libs/zos-fs.ts b/bin/libs/zos-fs.ts index 99305bc4b9..64eae0b2fd 100644 --- a/bin/libs/zos-fs.ts +++ b/bin/libs/zos-fs.ts @@ -20,11 +20,13 @@ import * as shell from './shell'; // Get file encoding from z/OS USS tagging export function getFileEncoding(filePath: string): number|undefined { //zos.changeTag(file, id) - let returnArray = os.stat(filePath); - if (!returnArray[1] && ((returnArray[0].mode & os.S_IFREG) == os.S_IFREG)) { //no error, and is file - return returnArray[0].ccsid; - } else { - common.printError(`getFileEncoding path=${filePath}, err=${returnArray[1]}`); + if (os.platform == 'zos') { + let returnArray = zos.zstat(filePath); + if (!returnArray[1] && ((returnArray[0].mode & os.S_IFMT) == os.S_IFREG)) { //no error, and is file + return returnArray[0].ccsid; + } else { + common.printError(`getFileEncoding path=${filePath}, err=${returnArray[1]}`); + } } return undefined; } diff --git a/build/zwe/types/@qjstypes/zos.d.ts b/build/zwe/types/@qjstypes/zos.d.ts index ec41ae6571..551948c5c2 100644 --- a/build/zwe/types/@qjstypes/zos.d.ts +++ b/build/zwe/types/@qjstypes/zos.d.ts @@ -11,8 +11,13 @@ export type ZStat = { dev: number; ino: number; + mode: number; + nlink: number; uid: number; gid: number; + rdev: number; + size: number; + blocks: number; atime: number; mtime: number; ctime: number;