mirror of
https://github.com/Open-Cascade-SAS/OCCT.git
synced 2026-07-28 15:58:33 +08:00
0022484: UNICODE characters support
Initial UNICODE (UFT-8) characters support for OCCT file operations Fix for compilation errors and fix for StepFile (avoid objects in pure c code) Fixes for set unicode symbols to OCAF and visualization
This commit is contained in:
@@ -192,6 +192,8 @@ Standard_Integer OSD_Process::Error()const{
|
||||
|
||||
#include <OSD_Path.hxx>
|
||||
#include <Quantity_Date.hxx>
|
||||
#include <Standard_PExtCharacter.hxx>
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
|
||||
#include <OSD_WNT_1.hxx>
|
||||
#include <LMCONS.H> /// pour UNLEN ( see MSDN about GetUserName() )
|
||||
@@ -246,7 +248,7 @@ void OSD_Process :: Spawn ( const TCollection_AsciiString& cmd ,
|
||||
|
||||
void OSD_Process :: TerminalType ( TCollection_AsciiString& Name ) {
|
||||
|
||||
Name = TEXT( "WIN32 console" );
|
||||
Name = "WIN32 console";
|
||||
|
||||
} // end OSD_Process :: TerminalType
|
||||
|
||||
@@ -361,10 +363,14 @@ OSD_Path OSD_Process :: CurrentDirectory () {
|
||||
OSD_Path anCurrentDirectory;
|
||||
|
||||
DWORD dwSize = PATHLEN + 1;
|
||||
Standard_PCharacter pBuff = new char[dwSize];
|
||||
Standard_WideChar* pBuff = new wchar_t[dwSize];
|
||||
|
||||
if ( GetCurrentDirectory(dwSize, pBuff) > 0 )
|
||||
anCurrentDirectory = OSD_Path ( pBuff );
|
||||
if ( GetCurrentDirectoryW(dwSize, (wchar_t*)pBuff) > 0 )
|
||||
{
|
||||
// conversion to UTF-8 is performed inside
|
||||
TCollection_AsciiString aPath(TCollection_ExtendedString((Standard_ExtString)pBuff));
|
||||
anCurrentDirectory = OSD_Path ( aPath );
|
||||
}
|
||||
else
|
||||
_osd_wnt_set_error ( myError, OSD_WProcess );
|
||||
|
||||
@@ -374,17 +380,12 @@ OSD_Path OSD_Process :: CurrentDirectory () {
|
||||
|
||||
void OSD_Process :: SetCurrentDirectory ( const OSD_Path& where ) {
|
||||
|
||||
#ifdef UNICODE
|
||||
# define SetCurrentDirectory SetCurrentDirectoryW
|
||||
#else
|
||||
# define SetCurrentDirectory SetCurrentDirectoryA
|
||||
#endif // UNICODE
|
||||
|
||||
TCollection_AsciiString path;
|
||||
|
||||
where.SystemName ( path );
|
||||
TCollection_ExtendedString pathW(path);
|
||||
|
||||
if ( !::SetCurrentDirectory ( path.ToCString () ) )
|
||||
if ( !::SetCurrentDirectoryW ( (const wchar_t*) pathW.ToExtString () ) )
|
||||
|
||||
_osd_wnt_set_error ( myError, OSD_WProcess );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user