Crash when using QFile::copy
-
Hello i am kinda in the same position as my friend.. This code:
@
if (!QDir(home_special).exists())
{
QDir dir;
dir.mkpath(home_special);
}
else
{QDir dir_get_all_pictures; dir_get_all_pictures.setPath(home_neobux); dir_get_all_pictures.setFilter(QDir::Files); QStringList filters; filters << "avatar*"; QStringList all_files=dir_get_all_pictures.entryList(filters); int all_files_count = all_files.count(); for (int i=0;all_files_count>i;i++) QFile(home_special+all_files.at(i)).remove(); } QFile::copy(path, home_special+"avatar"+fullname); ui->avatar_label->setPixmap(home_special+"avatar"+fullname);@
What the code does is, if the directory doesn't exist create it and copy an image while renaming the image to avatar. If the folder exists delete everything that is on the folder and starts from avatar, then copy the image and rename it avatar. Well this code works perfectly in Ubuntu, i just tested it in Windows and i get:
-
@Leon: I think "home_special+"avatar"+fullname" need some seperator, correct me if I'm wrong.
-
[quote author="A.A.B.A" date="1348203790"]@Leon: I think "home_special+"avatar"+fullname" need some seperator, correct me if I'm wrong.[/quote]
It wasn't the slashes problem.. the code i have posted here works perfectly, it was buggy in the part before this code :D..
-
Leon: please don't hijack other threads with "similar" problems. I splitted your messages.
Could you please add a [solved] in this thread's title and a description of the solution? Thanks.