2021-04-12 18:57:09 +03:00
|
|
|
const support_system_directory_fs = require("fs");
|
2020-07-06 18:58:02 +03:00
|
|
|
|
|
|
|
function support_system_directory_changeDir(d){
|
|
|
|
try{
|
2022-04-07 12:09:30 +03:00
|
|
|
process.chdir(d)
|
2021-07-10 13:15:21 +03:00
|
|
|
return 0
|
2020-07-06 18:58:02 +03:00
|
|
|
}catch(e){
|
2022-04-07 12:09:30 +03:00
|
|
|
process.__lasterr = e
|
2021-07-10 13:15:21 +03:00
|
|
|
return 1
|
2020-07-06 18:58:02 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function support_system_directory_createDir(d){
|
|
|
|
try{
|
|
|
|
support_system_directory_fs.mkdirSync(d)
|
2021-07-10 13:15:21 +03:00
|
|
|
return 0
|
2020-07-06 18:58:02 +03:00
|
|
|
}catch(e){
|
2022-04-07 12:09:30 +03:00
|
|
|
process.__lasterr = e
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function support_system_directory_removeDir(d){
|
|
|
|
try{
|
|
|
|
support_system_directory_fs.rmdirSync(d)
|
|
|
|
return 0
|
|
|
|
}catch(e){
|
|
|
|
process.__lasterr = e
|
2021-07-10 13:15:21 +03:00
|
|
|
return 1
|
2020-07-06 18:58:02 +03:00
|
|
|
}
|
|
|
|
}
|
2022-04-22 17:45:52 +03:00
|
|
|
|
|
|
|
function support_system_directory_openDir(d) {
|
|
|
|
try{
|
|
|
|
return support_system_directory_fs.opendirSync(d)
|
|
|
|
}catch(e){
|
|
|
|
process.__lasterr = e
|
|
|
|
return null
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function support_system_directory_closeDir(d) {
|
|
|
|
try{
|
|
|
|
d.closeSync()
|
|
|
|
}catch(e){
|
|
|
|
process.__lasterr = e
|
|
|
|
return null
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function support_system_directory_dirEntry(d) {
|
|
|
|
try{
|
|
|
|
const dir = d.readSync()
|
|
|
|
if (dir == null) {
|
|
|
|
return null
|
|
|
|
} else {
|
|
|
|
return dir.name
|
|
|
|
}
|
|
|
|
}catch(e){
|
|
|
|
process.__lasterr = e
|
|
|
|
return null
|
|
|
|
}
|
|
|
|
}
|