Such complexity for such simple task :/ And I just realized we copy paste that all over build.js files.
Please factor that out (appDir, stageDir, etc.). You can hide it in utils.getGaia, or anything.

Also we should start using path module. That may simplify all path related operations and get us compatible with node (at least for path...)
http://mxr.mozilla.org/mozilla-central/source/addon-sdk/source/test/test-path.js#29