So I need to make a directory if it's not exist by using QtObject. This code works fine inside a qml file but I need to create and use this code inside a javaScript file. How to do it?
QtObject {
id: internal
property url folderUrl: "image";
}
FileFolder {
id: fileFolder
url: "assets/media_images"//internal.folderUrl
Component.onCompleted: {
if (!fileFolder.exists) {
fileFolder.makeFolder(internal.folderUrl);
}
}
}
I think this documentation from Qt will help you, https://doc.qt.io/qt-5/qtqml-javascript-dynamicobjectcreation.html
Erwin.