From d3f7a9d6f1b8f6e24fb49aaa8caeaa7623ae48b5 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sat, 23 Jul 2011 17:13:36 -0500 Subject: Apply all Qt3.3.8d patches NOTE: This will *likely* break compilation of TQt4 Please wait a few days for fixes to be committed as needed! --- tqtinterface/qt4/src/tools/tqdir_unix.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'tqtinterface/qt4/src/tools/tqdir_unix.cpp') diff --git a/tqtinterface/qt4/src/tools/tqdir_unix.cpp b/tqtinterface/qt4/src/tools/tqdir_unix.cpp index 5d69993..f96808b 100644 --- a/tqtinterface/qt4/src/tools/tqdir_unix.cpp +++ b/tqtinterface/qt4/src/tools/tqdir_unix.cpp @@ -74,6 +74,20 @@ TQString TQDir::homeDirPath() TQString TQDir::canonicalPath() const { TQString r; +#if defined(__GLIBC__) && !defined(PATH_MAX) + char *cur = ::get_current_dir_name(); + if ( cur ) { + char *tmp = canonicalize_file_name( TQFile::encodeName( dPath ).data() ); + if ( tmp ) { + r = TQFile::decodeName( tmp ); + free( tmp ); + } + slashify( r ); + // always make sure we go back to the current dir + ::chdir( cur ); + free( cur ); + } +#else char cur[PATH_MAX+1]; if ( ::getcwd( cur, PATH_MAX ) ) { char tmp[PATH_MAX+1]; @@ -86,6 +100,7 @@ TQString TQDir::canonicalPath() const // always make sure we go back to the current dir ::chdir( cur ); } +#endif /* __GLIBC__ && !PATH_MAX */ return r; } @@ -147,9 +162,17 @@ TQString TQDir::currentDirPath() struct stat st; if ( ::stat( ".", &st ) == 0 ) { +#if defined(__GLIBC__) && !defined(PATH_MAX) + char *currentName = ::get_current_dir_name(); + if ( currentName ) { + result = TQFile::decodeName(currentName); + free( currentName ); + } +#else char currentName[PATH_MAX+1]; if ( ::getcwd( currentName, PATH_MAX ) ) result = TQFile::decodeName(currentName); +#endif /* __GLIBC__ && !PATH_MAX */ #if defined(TQT_DEBUG) if ( result.isNull() ) qWarning( "TQDir::currentDirPath: getcwd() failed" ); -- cgit v1.2.3