Logo Search packages:      
Sourcecode: inkscape version File versions  Download package

Glib::ustring Inkscape::Extension::get_file_save_path ( SPDocument doc,
FileSaveMethod  method 
)

Determine the desired default save path depending on the given FileSaveMethod. The returned string is guaranteed to be non-empty.

Parameters:
methodthe file save method of the dialog
docthe file's document
Returns:
the corresponding default save path

Definition at line 586 of file system.cpp.

References Inkscape::Preferences::get(), Inkscape::Preferences::getBool(), Inkscape::Preferences::getString(), and SPDocument::uri.

Referenced by sp_file_save_dialog().

                                                            {
    Inkscape::Preferences *prefs = Inkscape::Preferences::get();
    Glib::ustring path;
    switch (method) {
        case FILE_SAVE_METHOD_SAVE_AS:
        {
            bool use_current_dir = prefs->getBool("/dialogs/save_as/use_current_dir", true);
            if (doc->uri && use_current_dir) {
                path = Glib::path_get_dirname(doc->uri);
            } else {
                path = prefs->getString("/dialogs/save_as/path");
            }
            break;
        }
        case FILE_SAVE_METHOD_TEMPORARY:
            path = prefs->getString("/dialogs/save_as/path");
            break;
        case FILE_SAVE_METHOD_SAVE_COPY:
            path = prefs->getString("/dialogs/save_copy/path");
            break;
        case FILE_SAVE_METHOD_INKSCAPE_SVG:
            if (doc->uri) {
                path = Glib::path_get_dirname(doc->uri);
            } else {
                // FIXME: should we use the save_as path here or something else? Maybe we should
                // leave this as a choice to the user.
                path = prefs->getString("/dialogs/save_as/path");
            }
    }

    if(path.empty())
        path = g_get_home_dir(); // Is this the most sensible solution? Note that we should avoid
                                 // g_get_current_dir because this leads to problems on OS X where
                                 // Inkscape opens the dialog inside application bundle when it is
                                 // invoked for the first teim.

    return path;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index