Merge pull request #11362 from marcelofg55/fix_x11_export
Fix x11 exported executables not getting the +x flag
This commit is contained in:
commit
73b8e5acab
8 changed files with 43 additions and 4 deletions
|
@ -292,7 +292,7 @@ String DirAccess::get_full_path(const String &p_path, AccessType p_access) {
|
|||
return full;
|
||||
}
|
||||
|
||||
Error DirAccess::copy(String p_from, String p_to) {
|
||||
Error DirAccess::copy(String p_from, String p_to, int chmod_flags) {
|
||||
|
||||
//printf("copy %s -> %s\n",p_from.ascii().get_data(),p_to.ascii().get_data());
|
||||
Error err;
|
||||
|
@ -329,6 +329,11 @@ Error DirAccess::copy(String p_from, String p_to) {
|
|||
fdst->store_8(fsrc->get_8());
|
||||
}
|
||||
|
||||
if (err == OK && chmod_flags != -1) {
|
||||
fdst->close();
|
||||
err = fdst->_chmod(p_to, chmod_flags);
|
||||
}
|
||||
|
||||
memdelete(fsrc);
|
||||
memdelete(fdst);
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ public:
|
|||
static bool exists(String p_dir);
|
||||
virtual size_t get_space_left() = 0;
|
||||
|
||||
virtual Error copy(String p_from, String p_to);
|
||||
virtual Error copy(String p_from, String p_to, int chmod_flags = -1);
|
||||
virtual Error rename(String p_from, String p_to) = 0;
|
||||
virtual Error remove(String p_name) = 0;
|
||||
|
||||
|
|
|
@ -140,6 +140,8 @@ public:
|
|||
|
||||
virtual Error reopen(const String &p_path, int p_mode_flags); ///< does not change the AccessType
|
||||
|
||||
virtual Error _chmod(const String &p_path, int p_mod) {}
|
||||
|
||||
static FileAccess *create(AccessType p_access); /// Create a file access (for the current platform) this is the only portable way of accessing files.
|
||||
static FileAccess *create_for_path(const String &p_path);
|
||||
static FileAccess *open(const String &p_path, int p_mode_flags, Error *r_error = NULL); /// Create a file access (for the current platform) this is the only portable way of accessing files.
|
||||
|
|
|
@ -274,6 +274,15 @@ uint64_t FileAccessUnix::_get_modified_time(const String &p_file) {
|
|||
};
|
||||
}
|
||||
|
||||
Error FileAccessUnix::_chmod(const String &p_path, int p_mod) {
|
||||
int err = chmod(p_path.utf8().get_data(), p_mod);
|
||||
if (!err) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
return FAILED;
|
||||
}
|
||||
|
||||
FileAccess *FileAccessUnix::create_libc() {
|
||||
|
||||
return memnew(FileAccessUnix);
|
||||
|
|
|
@ -78,6 +78,8 @@ public:
|
|||
|
||||
virtual uint64_t _get_modified_time(const String &p_file);
|
||||
|
||||
virtual Error _chmod(const String &p_path, int p_mod);
|
||||
|
||||
FileAccessUnix();
|
||||
virtual ~FileAccessUnix();
|
||||
};
|
||||
|
|
|
@ -1246,9 +1246,13 @@ Error EditorExportPlatformPC::export_project(const Ref<EditorExportPreset> &p_pr
|
|||
}
|
||||
|
||||
DirAccess *da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
|
||||
da->copy(template_path, p_path);
|
||||
Error err = da->copy(template_path, p_path, get_chmod_flags());
|
||||
memdelete(da);
|
||||
|
||||
if (err != OK) {
|
||||
return err;
|
||||
}
|
||||
|
||||
String pck_path = p_path.get_basename() + ".pck";
|
||||
|
||||
return save_pack(p_preset, pck_path);
|
||||
|
@ -1302,5 +1306,17 @@ void EditorExportPlatformPC::get_platform_features(List<String> *r_features) {
|
|||
}
|
||||
}
|
||||
|
||||
EditorExportPlatformPC::EditorExportPlatformPC() {
|
||||
int EditorExportPlatformPC::get_chmod_flags() const {
|
||||
|
||||
return chmod_flags;
|
||||
}
|
||||
|
||||
void EditorExportPlatformPC::set_chmod_flags(int p_flags) {
|
||||
|
||||
chmod_flags = p_flags;
|
||||
}
|
||||
|
||||
EditorExportPlatformPC::EditorExportPlatformPC() {
|
||||
|
||||
chmod_flags = -1;
|
||||
}
|
||||
|
|
|
@ -319,6 +319,7 @@ class EditorExportPlatformPC : public EditorExportPlatform {
|
|||
Set<String> extra_features;
|
||||
|
||||
bool use64;
|
||||
int chmod_flags;
|
||||
|
||||
public:
|
||||
virtual void get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features);
|
||||
|
@ -347,6 +348,9 @@ public:
|
|||
void add_platform_feature(const String &p_feature);
|
||||
virtual void get_platform_features(List<String> *r_features);
|
||||
|
||||
int get_chmod_flags() const;
|
||||
void set_chmod_flags(int p_flags);
|
||||
|
||||
EditorExportPlatformPC();
|
||||
};
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ void register_x11_exporter() {
|
|||
platform->set_release_64("linux_x11_64_release");
|
||||
platform->set_debug_64("linux_x11_64_debug");
|
||||
platform->set_os_name("X11");
|
||||
platform->set_chmod_flags(0755);
|
||||
|
||||
EditorExport::get_singleton()->add_export_platform(platform);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue