Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Commit

Permalink
makeDir
Browse files Browse the repository at this point in the history
  • Loading branch information
yann300 committed May 26, 2016
1 parent b7f3dd9 commit 40a368c
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 11 deletions.
6 changes: 4 additions & 2 deletions qml/ProjectModel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,10 @@ Item {
onAccepted: {
if (!fileIo.dirExists(newFolderDialog.path))
{
fileIo.makeDir(newFolderDialog.path)
folderAdded(newFolderDialog.path)
if (fileIo.makeDir(newFolderDialog.path))
folderAdded(newFolderDialog.path)
else
alertMessageDialog.pop(qsTr("Error while creating folder"))
}
else
alertMessageDialog.pop(qsTr("Directory already exists"))
Expand Down
29 changes: 23 additions & 6 deletions qml/js/NetworkDeployment.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,12 @@ function copyFiles(path, target)
continue
var deployDir = target + dirs[i].fileName + "/"
if (!fileIo.dirExists(deployDir))
fileIo.makeDir(deployDir)
copyFiles(dirs[i].path, deployDir)
{
if (fileIo.makeDir(deployDir))
copyFiles(dirs[i].path, deployDir)
else
console.log('Unable to create package directory. Cannot create folder')
}
}
}
}
Expand All @@ -299,10 +303,23 @@ function packageDapp(addresses)

projectModel.deploymentDir = deploymentDir;
fileIo.deleteDir(deploymentDir)
fileIo.makeDir(deploymentDir);
var wwwFolder = deploymentDir + "/www/"
fileIo.makeDir(wwwFolder);
copyFiles(projectModel.projectPath, wwwFolder)
if (fileIo.makeDir(deploymentDir))
{
var wwwFolder = deploymentDir + "/www/"
if (fileIo.makeDir(wwwFolder))
copyFiles(projectModel.projectPath, wwwFolder)
else
{
console.log('cannot create ' + deploymentDir)
return
}
}
else
{
console.log('cannot create ' +wwwFolder)
return
}

//write deployment js
var deploymentJs =
"// Autogenerated by Mix\n" +
Expand Down
21 changes: 18 additions & 3 deletions qml/js/ProjectModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,11 @@ function doCreateProject(title, path) {
alertMessageDialog.pop(qsTr("Directory already exists. Unable to continue."))
return
}
fileIo.makeDir(dirPath);
if (!fileIo.makeDir(dirPath))
{
console.log('Cannot create project folder. Project not created')
return
}
var projectFile = dirPath + "/" + projectFileName;
var indexFile = "index.html";
var contractsFile = "contract.sol";
Expand Down Expand Up @@ -345,7 +349,11 @@ function generateFileName(name, extension) {
function regenerateCompilationResult()
{
fileIo.deleteDir(compilationFolder)
fileIo.makeDir(compilationFolder)
if (!fileIo.makeDir(compilationFolder))
{
console.log("compilation folder not created")
return
}
var ctrJson = {}
for (var c in codeModel.contracts)
{
Expand All @@ -360,7 +368,14 @@ function regenerateCompilationResult()
function saveContractCompilationResult(documentId)
{
if (!fileIo.dirExists(compilationFolder))
fileIo.makeDir(compilationFolder)
{
if (!fileIo.makeDir(compilationFolder))
{
console.log("Contract compilation result not created.")
return
}
}

var date = new Date()
var ret = "/*\nGenerated by Mix\n" + date.toString() + "\n*/\n\n"
var newCompilationResult = false
Expand Down

0 comments on commit 40a368c

Please sign in to comment.