atom/scandal — pull request #13 by frk1705 (2014-06-13 12:36:54+00:00)
Title: Fix EXDEV error on linux

What a bug hunt!
Reproduce: Atom, Find-And-Replace, Try replacing something in your project and __not__ having that file open.

#### Situation:
I'm using a fully dm-crypt + lvm encrypted system.
Additional to that my /home directory is encrypted with ecryptfs.

This results in `/` (including `/tmp`) and `/home` being on different 'devices'. Thus your call fails and nothing gets written (and replaced as consequence) if the file is not already open in buffer:

[src/path-replacer.coffee#L59](https://github.com/atom/scandal/blob/master/src/path-replacer.coffee#L59)

```
EXDEV, cross-device link not permitted '/tmp/s-114513-7666-vvnh1t' Error: EXDEV, cross-device link not permitted '/tmp/s-114513-7666-vvnh1t'
at Object.fs.renameSync (fs.js:535:18)
at WriteStream. (/home/squirtle/github/atom/node_modules/scandal/lib/path-replacer.js:104:12)
at WriteStream.EventEmitter.emit (events.js:123:20)
at finishMaybe (_stream_writable.js:437:14)
at afterWrite (_stream_writable.js:317:3)
at onwrite (_stream_writable.js:307:7)
at WritableState.onwrite (_stream_writable.js:100:5)
at fs.js:1664:5
at Object.wrapper [as oncomplete] (fs.js:482:7)
```

Feel free to modify my fix to your liking. :wink: