Skip to content

Commit

Permalink
Handle file paths > MAX_PATH
Browse files Browse the repository at this point in the history
  • Loading branch information
vbfox committed Apr 11, 2017
1 parent b2ef6ce commit 0bde4ef
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/util/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -484,12 +484,14 @@ if (process.platform === 'win32') {
'CopyFileW': ['uint32', [wchar_t.string, wchar_t.string, 'uint32']],
});

const longFileNamePrefix = "\\\\?\\";

copyFile = (reporter: Reporter, data: CopyFileAction) => new Promise((resolve, reject) => {
reporter.verbose(reporter.lang('verboseFileCopy', data.src, data.dest));

kernel32.CopyFileW.async(data.src, data.dest, 0, function(err, res) {
kernel32.CopyFileW.async(longFileNamePrefix + data.src, longFileNamePrefix + data.dest, 0, function(err, res) {
if (err || res === 0) {
reject();
reject(new Error("CopyFileW failed"));
}

resolve();
Expand Down

0 comments on commit 0bde4ef

Please sign in to comment.