fix soe
This commit is contained in:
@@ -14091,26 +14091,20 @@ void handleUploadResponse(const std::string& response, char* wavepath) {
|
||||
std::cout << "Uploaded File Name: " << fileName << std::endl;
|
||||
std::cout << "File URL: " << url << std::endl;
|
||||
|
||||
// <20>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB> '/'
|
||||
const char *lastSlash = strrchr(name.c_str(), '/');
|
||||
|
||||
if (lastSlash != NULL) {
|
||||
// ȡ '/' ֮<><D6AE><EFBFBD>IJ<EFBFBD><C4B2>֣<EFBFBD><D6A3><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
|
||||
const char *filename = lastSlash + 1;
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȳ<EFBFBD><C8B2>ֳ<EFBFBD>ǰ<EFBFBD>벿<EFBFBD>ֺͺ<D6BA><CDBA>벿<EFBFBD>ֽ<EFBFBD><D6BD>бȽϣ<C8BD>
|
||||
size_t len = strlen(filename);
|
||||
size_t halfLen = len / 2;
|
||||
if (strncmp(filename, filename + halfLen, halfLen) == 0) {
|
||||
strncpy(wavepath, filename, halfLen);
|
||||
wavepath[halfLen] = '\0'; // ȷ<><C8B7><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD> '\0' <20><>β
|
||||
} else {
|
||||
strcpy(wavepath, filename);
|
||||
}
|
||||
// <20>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB> '.'
|
||||
size_t pos = fileName.find_last_of('.');
|
||||
std::string nameWithoutExt;
|
||||
|
||||
if (pos != std::string::npos) {
|
||||
// <20><>ȡȥ<C8A1><C8A5><EFBFBD><EFBFBD><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>
|
||||
nameWithoutExt = fileName.substr(0, pos);
|
||||
} else {
|
||||
// <20><><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD> '/'<27><>ֱ<EFBFBD>Ӹ<EFBFBD><D3B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>
|
||||
strcpy(wavepath, name.c_str());
|
||||
// <20><><EFBFBD><EFBFBD>û<EFBFBD>к<EFBFBD><EFBFBD><EFBFBD>ֱ<EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD>ԭ<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>
|
||||
nameWithoutExt = fileName;
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> wavepath
|
||||
strcpy(wavepath, nameWithoutExt.c_str());
|
||||
|
||||
std::cout << "wavepath: " << wavepath << std::endl;
|
||||
}
|
||||
@@ -14254,11 +14248,11 @@ void SOEFileWeb(char* localpath,char* cloudpath, char* wavepath)
|
||||
|
||||
void SOEFileWeb_test()
|
||||
{
|
||||
char localpath[128] = {"./file_test.txt"};
|
||||
char cloudpath[128] = {"/comtrade/file_test.txt"};
|
||||
char localpath[128] = {"/FeProject/comtrade/his/PQMonitor_PQM1_000420_20250310_151030_923.cfg"};
|
||||
char cloudpath[128] = {"/comtrade/192.168.1.105/"};
|
||||
char wavepath[128] = {""};
|
||||
SOEFileWeb(localpath,cloudpath,wavepath);
|
||||
std::cout << "wavepath" << wavepath << std::endl;
|
||||
std::cout << "wavepath:" << wavepath << std::endl;
|
||||
}
|
||||
/*/////////////////////////////////////////////////////////lnk10-24<32><34><EFBFBD><EFBFBD>web<65>ӿ<EFBFBD><D3BF><EFBFBD>/////////////////////////////////////////////////////////////*/
|
||||
/*<2A><>װC<D7B0>ɵ<EFBFBD><C9B5>õ<EFBFBD>̨<EFBFBD>˸<EFBFBD><CBB8>º<EFBFBD><C2BA><EFBFBD> */////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user