Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
Inkscape::IO::Sandbox Namespace Reference

Functions

bool filesystem_is_sandboxed ()
 Query if the filesystem is "sandboxed", e.g., by using xdg-portal in flatpak/snap.
 
Glib::ustring filesystem_get_display_path (std::optional< Glib::RefPtr< Gio::File const > > path, Glib::ustring placeholder_if_empty="")
 Translate raw filesystem path to a path suitable for display.
 

Function Documentation

◆ filesystem_get_display_path()

Glib::ustring Inkscape::IO::Sandbox::filesystem_get_display_path ( std::optional< Glib::RefPtr< Gio::File const > >  path,
Glib::ustring  placeholder_if_empty = "" 
)

Translate raw filesystem path to a path suitable for display.

This function is similar to Gio::File::get_parse_name() and Glib::filename_display_name() but understands filesystem sandboxing.

Parameters
pathFile object representing the path (may be a folder or file). To represent empty values, use std::nullopt or Gio::File::create_from_path("").
placeholder_if_emptyPlaceholder to be returned if the input path is empty. Value is in UTF8 encoding.
Returns
"Human-readable" path that can be shown to the user. If possible, this is a full path. If not, it may only be a file or folder name. This new path should not be used programmatically and should not be edited by the user. Value is in UTF8 encoding.

Definition at line 27 of file sandbox.cpp.

References filesystem_is_sandboxed().

Referenced by Inkscape::UI::Dialog::BatchExport::onExport(), Inkscape::UI::Dialog::SingleExport::onExport(), Inkscape::UI::Dialog::BatchExport::setBatchPath(), and Inkscape::UI::Dialog::SingleExport::setFilename().

◆ filesystem_is_sandboxed()

bool Inkscape::IO::Sandbox::filesystem_is_sandboxed ( )

Query if the filesystem is "sandboxed", e.g., by using xdg-portal in flatpak/snap.

Returns
False if we have traditional full access to the filesystem. True if we do not have full direct access to the host filesystem. As detailed on the top of this source file, "True" can mean that:
  • The paths we receive from the file chooser are not the true paths on the host filesystem
  • The user should not be able to manually enter or edit paths in a textbox, because we don't have access to these without calling the file chooser.

Definition at line 17 of file sandbox.cpp.

Referenced by filesystem_get_display_path(), Inkscape::UI::Dialog::BatchExport::getPreviousBatchPath(), Inkscape::UI::Dialog::BatchExport::setBatchPath(), Inkscape::UI::Dialog::SingleExport::setFilename(), and Inkscape::UI::Dialog::SingleExport::setup().