Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to previous messageGo to previous message
kasome is currently offline  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 Very Happy )


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.

index.php?t=getfile&id=1343&private=0

U++ is an amazing Tool. Thank you. Very Happy

[Updated on: Thu, 28 August 2008 15:03]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Some 'missing' string functions
Next Topic: String filter whitespace
Goto Forum:
  


Current Time: Fri Jul 18 08:01:54 CEST 2025

Total time taken to generate the page: 0.04149 seconds