I'm asking for a feature request.
If we want to add truffle to an existing project, we need to copy/paste files manually because of this error :
$ truffle init
Downloading...
Error: Something already exists at the destination. Please unbox in an empty folder. Stopping to prevent overwriting data.
at /Users/fjalcaraz/.nvm/versions/node/v8.11.1/lib/node_modules/truffle/build/webpack:/~/truffle-box/lib/utils/unbox.js:22:1
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
at Function.Module.runMain (module.js:695:11)
at startup (bootstrap_node.js:188:16)
at bootstrap_node.js:609:3
It would be great if truffle checked if files are going to be overwritten, if not, it can init, if yes, show this error message.
@hefgi Agree this would be nice, especially for truffle init. Cross referencing to truffle-core 117 which would solve several other issues as well.
Workaround
# From within a project that already has lots of contents
mkdir truffle-bare
cd truffle-bare
truffle init
cd ..
mv truffle-bare/* .
rm -rf truffle-bare
@hefgi @cgewecke
The problem is for example the folder can contain system files. For example in OSX it is .DS_Store. So even if the folder looks like empty truffle rejects to work with it and requires a "Superempty" folder which contains zero system files.
This feature has been added in version 5!
Most helpful comment
@hefgi Agree this would be nice, especially for truffle init. Cross referencing to truffle-core 117 which would solve several other issues as well.
Workaround