我正在尝试按照本教程进行操作。基本上,我想创建我的自定义函数来创建一个文件夹(如果该文件夹不存在)。
var makeDir = (path) => {
const file = Gio.file_new_for_path(path);
if (file.query_exists(path)) {
print(`Dir already exists ${path}`);
return;
}
print(`My Path: ${path}`);
// file.make_directory(path);
};
当我运行此代码时,我收到一个错误:
Gjs-CRITICAL **: 17:35:17.161: JS ERROR: Error: Expected an object of type GCancellable for argument 'cancellable' but got type string
在文档中,我看到GCancellable是可选的。所以我不知道为什么我的代码不起作用。我能使它正常运作吗?
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句