Permision Denaied with Gio::File::copy()



Hi every one,

I'm tring to  build a Gtkmm Application for a windows Xp OS which will
allow, to the user, install some selected files to a specific directory.

The user selects a File using Gtk::FileChooserDialog, then the
application will copy it to a specific directory which the application
searches in WindowsRegistry.

If the directory does not exists the application will create it:


----- Code---
try
    {
        Glib::RefPtr<Gio::File> fromFile =
Gio::File::create_for_path(fileDialog.get_filename ());
        Glib::RefPtr<Gio::File> toDirectory =
Gio::File::create_for_path(licenceFilePath);
     
        Glib::RefPtr<Gio::File> toFile =
Gio::File::create_for_path(licenceFilePath + nameOfFile);


  
       
        if (!toDirectory->query_exists ())
       {
            toDirectory->make_directory ();
           
        }

        fromFile->copy(toFile);

    }
    catch(const Glib::Exception& ex)
    {
        std::cout << "Exception ocurred: " << ex.what() << std::endl;
    }

The code fails catching the following exception : Permision Denied;

I went to the directory And the Read-Only check box was cheked. I
unchecked and tryied again and the file was successfuly copied.

1- How can i force to copy the file with the Red-Only option?
2- How can I create the directory without the Read-Only Active (The
folder created with make_dir has the Read-Only active)
3- I sow that All folders in windows have this flag active, this means
that if question 1 has no solution I cant create files?


Thanks,
Filipe





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]