Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Slic3r::anonymous_namespace{PresetUpdater.cpp} Namespace Reference

Functions

void copy_file_fix (const fs::path &source, const fs::path &target)
 
std::string escape_string_url (const std::string &unescaped)
 

Function Documentation

◆ copy_file_fix()

void Slic3r::anonymous_namespace{PresetUpdater.cpp}::copy_file_fix ( const fs::path &  source,
const fs::path &  target 
)
57{
58 BOOST_LOG_TRIVIAL(debug) << format("PresetUpdater: Copying %1% -> %2%", source, target);
59 std::string error_message;
60 CopyFileResult cfr = copy_file(source.string(), target.string(), error_message, false);
61 if (cfr != CopyFileResult::SUCCESS) {
62 BOOST_LOG_TRIVIAL(error) << "Copying failed(" << cfr << "): " << error_message;
63 throw Slic3r::CriticalException(GUI::format(
64 _L("Copying of file %1% to %2% failed: %3%"),
65 source, target, error_message));
66 }
67 // Permissions should be copied from the source file by copy_file(). We are not sure about the source
68 // permissions, let's rewrite them with 644.
69 static constexpr const auto perms = fs::owner_read | fs::owner_write | fs::group_read | fs::others_read;
70 fs::permissions(target, perms);
71}
CopyFileResult copy_file(const std::string &from, const std::string &to, std::string &error_message, const bool with_check)
Definition utils.cpp:707
CopyFileResult
Definition Utils.hpp:80
std::string format(const char *fmt, TArgs &&... args)
Definition format.hpp:44
#define _L(s)
Definition I18N.hpp:3
static char error[256]
Definition tga.cpp:50

References _L, Slic3r::copy_file(), copy_file_fix(), error, Slic3r::format(), Slic3r::GUI::format(), and Slic3r::SUCCESS.

Referenced by copy_file_fix().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ escape_string_url()

std::string Slic3r::anonymous_namespace{PresetUpdater.cpp}::escape_string_url ( const std::string &  unescaped)
73{
74 std::string ret_val;
75 CURL* curl = curl_easy_init();
76 if (curl) {
77 char* decoded = curl_easy_escape(curl, unescaped.c_str(), unescaped.size());
78 if (decoded) {
79 ret_val = std::string(decoded);
80 curl_free(decoded);
81 }
82 curl_easy_cleanup(curl);
83 }
84 return ret_val;
85}

References escape_string_url().

Referenced by escape_string_url().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: