| 2252 | } |
| 2253 | |
| 2254 | AppInstancePtr |
| 2255 | AppInstance::loadProject(const std::string& filename) |
| 2256 | { |
| 2257 | QFileInfo file( QString::fromUtf8( filename.c_str() ) ); |
| 2258 | |
| 2259 | if ( !file.exists() ) { |
| 2260 | return AppInstancePtr(); |
| 2261 | } |
| 2262 | QString fileUnPathed = file.fileName(); |
| 2263 | QString path = file.path() + QChar::fromLatin1('/'); |
| 2264 | |
| 2265 | //We are in background mode, there can only be 1 instance active, wipe the current project |
| 2266 | ProjectPtr project = getProject(); |
| 2267 | project->resetProject(); |
| 2268 | |
| 2269 | bool ok = project->loadProject( path, fileUnPathed); |
| 2270 | if (ok) { |
| 2271 | return shared_from_this(); |
| 2272 | } |
| 2273 | |
| 2274 | project->resetProject(); |
| 2275 | |
| 2276 | return AppInstancePtr(); |
| 2277 | } |
| 2278 | |
| 2279 | ///Close the current project but keep the window |
| 2280 | bool |
no test coverage detected