diff options
| author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-07-23 17:13:36 -0500 |
|---|---|---|
| committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-07-23 17:13:36 -0500 |
| commit | d3f7a9d6f1b8f6e24fb49aaa8caeaa7623ae48b5 (patch) | |
| tree | baeeba639393f46abab749f4700a250091c3cc16 /tqtinterface/qt4/src/tools/tqdir_unix.cpp | |
| parent | d7be1694839bacae31e500ea9e36b3c13257ce28 (diff) | |
| download | experimental-d3f7a9d6f1b8f6e24fb49aaa8caeaa7623ae48b5.tar.gz experimental-d3f7a9d6f1b8f6e24fb49aaa8caeaa7623ae48b5.zip | |
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!
Diffstat (limited to 'tqtinterface/qt4/src/tools/tqdir_unix.cpp')
| -rw-r--r-- | tqtinterface/qt4/src/tools/tqdir_unix.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
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" ); |
