bsdiff-node icon indicating copy to clipboard operation
bsdiff-node copied to clipboard

[BUG] Error: No such file or directory when the file path contains chinese character

Open famingyuan opened this issue 3 years ago • 7 comments

the patch api throws error 'No such file or directory' when the file path contains chinese character on Windows 10.

const oldFile = 'C:\\Users\\famingyuan\\Desktop\\rhtx\\release\\1.2.0\\v1.2.0-win64-prod-c626ef.asar'
const newFile = 'C:\\Users\\famingyuan\\Desktop\\rhtx\\release\\1.3.0\\result.asar'
const patchFile = 'C:\\Users\\famingyuan\\Desktop\\rhtx\\release\\1.3.0\\中文\\win64-prod-c626ef-96fdc1.patch'
try {

  bsdiff.patch(oldFile, newFile, patchFile, function (result) {
    // console.log('progress:' + result + '%')
  })
} catch (err) {
  console.error(err) //  No such file or directory 
}

famingyuan avatar Dec 16 '21 07:12 famingyuan

same issue, need help

FatShen3 avatar Dec 16 '21 08:12 FatShen3

Thanks for your feedback. Don't hesitate to make a PR.

gaetandezeiraud avatar Dec 16 '21 12:12 gaetandezeiraud

Thanks for your feedback. Don't hesitate to make a PR.

😂Really know very very little about cpp.

FatShen3 avatar Dec 16 '21 13:12 FatShen3

I don't have time now. But I checked this soon as possible.

gaetandezeiraud avatar Dec 28 '21 20:12 gaetandezeiraud

I don't have time now. But I checked this soon as possible.

Thanks♪(・ω・)ノ

FatShen3 avatar Dec 29 '21 01:12 FatShen3

It seems to have the same problem with accents like "é" and similar on Windows.

gaetandezeiraud avatar Dec 30 '21 21:12 gaetandezeiraud

I just saw that by trying to print a unicode character (std::cout << é << std::endl; or printf). I have the same problem. So it doesn't seem to be related to Nan::Utf8String. Rather on the side of node-gyp. I tried to add UNICODE, _UNICODE in the binding.gyp but not success.

gaetandezeiraud avatar Dec 31 '21 10:12 gaetandezeiraud

same issue, need help

I just saw that by trying to print a unicode character (std::cout << é << std::endl; or printf). I have the same problem. So it doesn't seem to be related to Nan::Utf8String. Rather on the side of node-gyp. I tried to add UNICODE, _UNICODE in the binding.gyp but not success.

I fixed it, look at this PR: https://github.com/Brouilles/bsdiff-node/pull/26

jrainlau avatar Nov 14 '23 06:11 jrainlau

Version 2.5.0 now available with your PR. Thanks.

gaetandezeiraud avatar Nov 14 '23 08:11 gaetandezeiraud