diff options
Diffstat (limited to 'src/fileaccess.cpp')
-rw-r--r-- | src/fileaccess.cpp | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/src/fileaccess.cpp b/src/fileaccess.cpp index 0dc0511..205b75e 100644 --- a/src/fileaccess.cpp +++ b/src/fileaccess.cpp @@ -46,7 +46,14 @@ ProgressDialog* g_pProgressDialog=0; -FileAccess::FileAccess( const TQString& name, bool bWantToWrite ) +FileAccess::FileAccess( const TQString& name, bool bWantToWrite ) : + m_workingDir(TQString::null) +{ + setFile( name, bWantToWrite ); +} + +FileAccess::FileAccess( const TQString& workingDir, const TQString& name, bool bWantToWrite ) : + m_workingDir(workingDir) { setFile( name, bWantToWrite ); } @@ -111,7 +118,15 @@ void FileAccess::setFile( const TQString& name, bool bWantToWrite ) // 1. When the local file exists and the remote location is wanted nevertheless. (unlikely) // 2. When the local file doesn't exist and should be written to. - bool bExistsLocal = TQDir().exists(name); + bool bExistsLocal = false; + if (!m_workingDir.isEmpty()) + { + bExistsLocal = TQDir(m_workingDir).exists(name); + } + else + { + bExistsLocal = TQDir().exists(name); + } if ( m_url.isLocalFile() || !m_url.isValid() || bExistsLocal ) // assuming that invalid means relative { TQString localName = name; @@ -119,7 +134,15 @@ void FileAccess::setFile( const TQString& name, bool bWantToWrite ) { localName = m_url.path(); // I want the path without preceding "file:" } - TQFileInfo fi( localName ); + TQFileInfo fi; + if (!m_workingDir.isEmpty()) + { + fi = TQFileInfo( m_workingDir, localName ); + } + else + { + fi = TQFileInfo( localName ); + } #if defined(TQ_WS_WIN) // On some windows machines in a network this takes very long. // and it's not so important anyway. @@ -158,7 +181,15 @@ void FileAccess::setFile( const TQString& name, bool bWantToWrite ) TQString cmd = "cleartool get -to \"" + m_localCopy + "\" \"" + m_absFilePath + "\""; ::system( cmd.local8Bit() ); - TQFileInfo fi( m_localCopy ); + TQFileInfo fi; + if (!m_workingDir.isEmpty()) + { + fi = TQFileInfo( m_workingDir, m_localCopy ); + } + else + { + fi = TQFileInfo( m_localCopy ); + } #if defined(TQ_WS_WIN) m_bReadable = true;//fi.isReadable(); m_bWritable = true;//fi.isWritable(); |