Re: Permision Denaied with Gio::File::copy()
- From: Filipe Apostolo <f apostolo cbr gmail com>
- To: GTKmm List <gtkmm-list gnome org>
- Subject: Re: Permision Denaied with Gio::File::copy()
- Date: Wed, 26 Jan 2011 13:55:50 +0000
Sorry,
now I find out that it only happens if the directory is created by
" toDirectory->make_directory ()". If it is created manually it works
(Right click-> create new folder) with the Read-Only checked as well.
So I supose that I've some how give the right permissions when creating
directory.
How it is done?
Thanks,
Filipe
Filipe Apostolo wrote:
> 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]