Mercurial > hg > svcore
comparison base/TempDirectory.cpp @ 86:e076e676439b
* Add file open/save operations to main toolbar
* Allow opening any sort of file from toolbar file open function
* First cut at on-disc cacheing for decoded mp3/ogg files
* Permit un-snapped selection by holding Shift
author | Chris Cannam |
---|---|
date | Thu, 27 Apr 2006 17:29:19 +0000 |
parents | b2067aff8cd6 |
children | 604bd4ee3ed4 |
comparison
equal
deleted
inserted
replaced
85:ea730e3f9ace | 86:e076e676439b |
---|---|
68 { | 68 { |
69 QMutexLocker locker(&m_mutex); | 69 QMutexLocker locker(&m_mutex); |
70 | 70 |
71 if (m_tmpdir != "") return m_tmpdir; | 71 if (m_tmpdir != "") return m_tmpdir; |
72 | 72 |
73 QDir systemTempDir = QDir::temp(); | 73 //!!! QDir tempDirBase = QDir::temp(); |
74 QDir tempDirBase = QDir::home(); | |
74 | 75 |
75 // Generate a temporary directory. Qt4.1 doesn't seem to be able | 76 // Generate a temporary directory. Qt4.1 doesn't seem to be able |
76 // to do this for us, and mkdtemp is not standard. This method is | 77 // to do this for us, and mkdtemp is not standard. This method is |
77 // based on the way glibc does mkdtemp. | 78 // based on the way glibc does mkdtemp. |
78 | 79 |
96 v /= 62; | 97 v /= 62; |
97 } | 98 } |
98 | 99 |
99 QString candidate = QString("sv_%1").arg(suffix); | 100 QString candidate = QString("sv_%1").arg(suffix); |
100 | 101 |
101 if (QDir::temp().mkpath(candidate)) { | 102 if (tempDirBase.mkpath(candidate)) { |
102 m_tmpdir = systemTempDir.filePath(candidate); | 103 m_tmpdir = tempDirBase.filePath(candidate); |
103 break; | 104 break; |
104 } | 105 } |
105 | 106 |
106 r = r + 7777; | 107 r = r + 7777; |
107 } | 108 } |
108 | 109 |
109 if (m_tmpdir == "") { | 110 if (m_tmpdir == "") { |
110 throw DirectoryCreationFailed(QString("temporary subdirectory in %1") | 111 throw DirectoryCreationFailed(QString("temporary subdirectory in %1") |
111 .arg(systemTempDir.canonicalPath())); | 112 .arg(tempDirBase.canonicalPath())); |
112 } | 113 } |
113 | 114 |
114 return m_tmpdir; | 115 return m_tmpdir; |
115 } | 116 } |
116 | 117 |