Fixed: Moved out nib2cib functions to correct scope so they can be accessed by catch

This commit is contained in:
Martin Carlberg
2021-10-04 12:51:12 +02:00
parent 1440c156b2
commit c9e8b2970b
+19 -18
View File
@@ -120,6 +120,25 @@ ConverterConversionException = @"ConverterConversionException";
var temporaryNibFilePath = "",
temporaryPlistFilePath = "";
function isReadable(p) {
try {
fs.accessSync(p, fs.constants.R_OK);
return true;
} catch (err) {
return false;
}
}
function isWritable(p) {
try {
fs.accessSync(p, fs.constants.W_OK);
return true;
} catch (err) {
return false;
}
}
try
{
var tmpdir = fs.mkdtempSync(path.join(os.tmpdir(), 'nib2cib-'));
@@ -169,24 +188,6 @@ ConverterConversionException = @"ConverterConversionException";
p.stderr.close();
} */
function isReadable(p) {
try {
fs.accessSync(p, fs.constants.R_OK);
return true;
} catch (err) {
return false;
}
}
function isWritable(p) {
try {
fs.accessSync(p, fs.constants.W_OK);
return true;
} catch (err) {
return false;
}
}
if (!isReadable(temporaryPlistFilePath))
[CPException raise:ConverterConversionException reason:@"Unable to convert nib file."];