Fixed some FT stuff

This commit is contained in:
WolverinDEV 2019-10-26 01:42:51 +02:00
parent 55f3f7656a
commit 53d3814f92
2 changed files with 11 additions and 2 deletions

View File

@ -113,7 +113,7 @@ namespace _transfer {
if(data.size != this.transfer_key.total_size)
throw "invalid size";
throw "files arent yet supported";
buffer = native.ft.upload_transfer_object_from_file(data.path, data.name);
} else if(typeof(data) === "string") {
if(data.length != this.transfer_key.total_size)
throw "invalid size";

View File

@ -178,7 +178,16 @@ void TransferObjectWrap::do_wrap(v8::Local<v8::Object> object) {
}
#endif
TransferFileSource::TransferFileSource(std::string path, std::string name) : _path{std::move(path)}, _name{std::move(name)} { }
TransferFileSource::TransferFileSource(std::string path, std::string name) : _path{std::move(path)}, _name{std::move(name)} {
if(!this->_path.empty()) {
if(this->_path.back() == '/')
this->_path.pop_back();
#ifdef WIN32
if(this->_path.back() == '\\')
this->_path.pop_back();
#endif
}
}
#ifdef WIN32
#define u8path path