System clipboard
Usually, the copy/paste functionality involves system clipboard. NW.js
provides an API to control it (http://docs.nwjs.io/en/latest/References/Clipboard/). Unfortunately, it's quite limited; we cannot transfer an arbitrary file between applications, which you may expect of a file manager. Yet, some things are still available to us.
Transferring text
In order to examine text transferring with the clipboard, we modify the method copy of FileService
:
copy( file ){ this.copiedFile = this.dir.getFile( file ); const clipboard = nw.Clipboard.get(); clipboard.set( this.copiedFile, "text" ); }
What does it do? As soon as we obtain the file full path, we create an instance of nw.Clipboard
and save the file path there as text. So now, after copying a file within the File Explorer, we can switch to an external program (for example, a text editor) and paste the copied path from the clipboard:

Transferring graphics
It doesn't look very handy, does it? It would be more interesting...