mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Cloud storage: use QDir instead of QFile for renaming directories
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
		
							parent
							
								
									aa76f74f97
								
							
						
					
					
						commit
						b1dca1176f
					
				
					 1 changed files with 7 additions and 7 deletions
				
			
		
							
								
								
									
										14
									
								
								qthelper.cpp
									
										
									
									
									
								
							
							
						
						
									
										14
									
								
								qthelper.cpp
									
										
									
									
									
								
							|  | @ -631,22 +631,22 @@ extern "C" char *move_away(const char *old_path) | ||||||
| { | { | ||||||
| 	if (verbose > 1) | 	if (verbose > 1) | ||||||
| 		qDebug() << "move away" << old_path; | 		qDebug() << "move away" << old_path; | ||||||
| 	QFile oldFile(old_path); | 	QDir oldDir(old_path); | ||||||
| 	QFile newFile; | 	QDir newDir; | ||||||
| 	QString newPath; | 	QString newPath; | ||||||
| 	int i = 0; | 	int i = 0; | ||||||
| 	do { | 	do { | ||||||
| 		newPath = QString(old_path) + QString(".%1").arg(++i); | 		newPath = QString(old_path) + QString(".%1").arg(++i); | ||||||
| 		newFile.setFileName(newPath); | 		newDir.setPath(newPath); | ||||||
| 	} while(newFile.exists()); | 	} while(newDir.exists()); | ||||||
| 	if (verbose > 1) | 	if (verbose > 1) | ||||||
| 		qDebug() << "renaming to" << newPath; | 		qDebug() << "renaming to" << newPath; | ||||||
| 	if (!oldFile.rename(newPath)) { | 	if (!oldDir.rename(old_path, newPath)) { | ||||||
| 		qDebug() << "rename of" << old_path << "to" << newPath << "failed"; | 		if (verbose) | ||||||
|  | 			qDebug() << "rename of" << old_path << "to" << newPath << "failed"; | ||||||
| 		return strdup(""); | 		return strdup(""); | ||||||
| 	} | 	} | ||||||
| 	return strdup(qPrintable(newPath)); | 	return strdup(qPrintable(newPath)); | ||||||
| 
 |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| extern "C" char *get_file_name(const char *fileName) | extern "C" char *get_file_name(const char *fileName) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue