Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

support haraldutil 0.1.14

  • Loading branch information...
commit 100bca9128f4c9d93d3c6f60b3438b5a762dbd70 1 parent 84760b1
@haraldrudell authored
Showing with 14 additions and 13 deletions.
  1. +12 −11 lib/watchcopy.js
  2. +2 −2 webprocess.js
View
23 lib/watchcopy.js
@@ -62,7 +62,7 @@ function watchCopy(id) {
from: path.resolve(folder, String(from)),
watchers: [],
}
- return instance
+ return instance
}
function setTime(newTime) {
@@ -117,7 +117,7 @@ function watchCopy(id) {
var index = getIndex(updateInstance)
if (index === false) {
- // add new instance
+ // add new instance
restart = true
index = copy.length
addInstance(updateInstance, count)
@@ -153,7 +153,9 @@ function watchCopy(id) {
}
function doCopy(instance, count, watchFunc) {
- console.log(arguments.callee.name, instance.from, instance.to)
+ console.log(arguments.callee.name,
+ 'from:', instance.from,
+ 'to:', instance.to)
// to must exist!
var toType = haraldutil.getType(instance.to)
if (toType === undefined) count.dec(Error('destination does not exist:' + instance.to))
@@ -162,22 +164,21 @@ function doCopy(instance, count, watchFunc) {
var fromType = haraldutil.getType(instance.from)
if (fromType === undefined) count.dec(Error('source does not exist:' + instance.from))
// if to is a file, from must be a file
- if (toType) {
- if (!fromType) count.dec(Error('Cannot copy folder onto this file:' + instance.to))
+ if (toType === true) { // to is a file
+ if (fromType !== true) count.dec(Error('Cannot copy folder onto this file:' + instance.to))
// copy file to file
copyFile(instance.from, instance.to)
- } else {
- // to is a folder, from is a file or a folder
- if (fromType) {
+ } else { // to is a folder, from is a file or a folder
+ if (fromType === true) {
// copy file to folder
var toFile = path.join(instance.to, path.basename(instance.from))
copyFile(instance.from, toFile)
- }
- // copy folder to folder
- copyFolder(instance.from, instance.to)
+
+ // copy folder to folder
+ } else copyFolder(instance.from, instance.to)
}
function copyFolder(from, to) {
View
4 webprocess.js
@@ -11,11 +11,11 @@ var express = require('express')
// https://github.com/haraldrudell/apprunner
var apprunner = require('apprunner')
//apprunner.enableAnomalyMail(false)
-var cbc = apprunner.getCbCounter(/*{callback: initAppResult}*/)
+var cbCounter = 2 // background+initApp
// get app and start error listener
var app = module.exports = express.createServer()
-apprunner.initApp(defaults, app, cbc.add(initAppResult))
+apprunner.initApp(defaults, app, initAppResult)
var godcontrol = require('./lib/godcontrol')
var godview = require('./routes/godview')
Please sign in to comment.
Something went wrong with that request. Please try again.