Home » U++ Library support » U++ Core » Path including non-English character, buglog and usrlog file cannot be deleted
Re: Path including non-English character, buglog and usrlog file cannot be deleted [message #17773 is a reply to message #17582] |
Thu, 28 August 2008 14:50   |
kasome
Messages: 78 Registered: July 2008 Location: Taiwan
|
Member |
|
|
I am so sorry replying late. Here is my some result.
When i put "ToUtf8( WideString( filename )" to the function "ToSystemCharsetW". i found something wrong when i try to delete and create file with Chinese filenames, so i try to trace the code. Finally, i find out the better solution.
just find the code in
c:\upp\uppsrc\Core\Log.cpp
bool LogStream::Delete()
{
Close();
if(*filename) {
if( !FileDelete( filename ) ) {
BugLog() << "Error deleting " << filename << ": " << GetLastErrorMessage();
return false;
}
*filename = 0;
}
return true;
}
and fix as the following
bool LogStream::Delete()
{
Close();
if(*filename) {
if( !FileDelete( FromSystemCharset(filename) ) ) {
BugLog() << "Error deleting " << filename << ": " << GetLastErrorMessage();
return false;
}
*filename = 0;
}
return true;
}
The function "FromSystemCharset" embbed in U++ and the function "WideString" is equivilent.
Because "FileDelete" should take UTF8 string as argument, and filename seem to just the ansi string, covert ansi string to utf8 by the function "FromSystemCharset" should solve the problem (e.g. the problem when path including non-English character, buglog and usrlog file cannot be deleted).
Now everything is work fine. ( i hope so )
BTW, here is some test code i wrote to test the two function (in c:\upp\uppsrc\Core\Path.cpp ) "FileDelete" and "DirectoryDelete" in processing file with the path including chinese characters, and it works very well in my OS.These two function has no problem when i test.

U++ is an amazing Tool. Thank you.
[Updated on: Thu, 28 August 2008 15:03] Report message to a moderator
|
|
|
 |
|
Path including non-English character, buglog and usrlog file cannot be deleted
By: kasome on Thu, 21 August 2008 09:16
|
 |
|
Re: Path including non-English character, buglog and usrlog file cannot be deleted
By: mirek on Thu, 21 August 2008 16:48
|
 |
|
Re: Path including non-English character, buglog and usrlog file cannot be deleted
By: kasome on Thu, 28 August 2008 14:50
|
 |
|
Re: Path including non-English character, buglog and usrlog file cannot be deleted
By: mirek on Thu, 28 August 2008 15:27
|
 |
|
Re: Path including non-English character, buglog and usrlog file cannot be deleted
By: mirek on Thu, 28 August 2008 15:29
|
 |
|
Re: Path including non-English character, buglog and usrlog file cannot be deleted
By: kasome on Thu, 28 August 2008 16:33
|
Goto Forum:
Current Time: Fri Jul 18 08:01:54 CEST 2025
Total time taken to generate the page: 0.04149 seconds
|