diff options
Diffstat (limited to 'core/os')
-rw-r--r-- | core/os/dir_access.cpp | 9 | ||||
-rw-r--r-- | core/os/dir_access.h | 2 | ||||
-rw-r--r-- | core/os/file_access.h | 4 | ||||
-rw-r--r-- | core/os/input.cpp | 2 | ||||
-rw-r--r-- | core/os/input.h | 2 | ||||
-rw-r--r-- | core/os/input_event.cpp | 2 | ||||
-rw-r--r-- | core/os/os.h | 2 |
7 files changed, 15 insertions, 8 deletions
diff --git a/core/os/dir_access.cpp b/core/os/dir_access.cpp index f24d6d16ca..0875f78478 100644 --- a/core/os/dir_access.cpp +++ b/core/os/dir_access.cpp @@ -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; @@ -312,7 +312,7 @@ Error DirAccess::copy(String p_from, String p_to) { } fsrc->seek_end(0); - int size = fsrc->get_pos(); + int size = fsrc->get_position(); fsrc->seek(0); err = OK; while (size--) { @@ -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); diff --git a/core/os/dir_access.h b/core/os/dir_access.h index 6ad8b4c49b..7fa3ce5cf1 100644 --- a/core/os/dir_access.h +++ b/core/os/dir_access.h @@ -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; diff --git a/core/os/file_access.h b/core/os/file_access.h index 8e5728f525..34e7549fa3 100644 --- a/core/os/file_access.h +++ b/core/os/file_access.h @@ -90,7 +90,7 @@ public: virtual void seek(size_t p_position) = 0; ///< seek to a given position virtual void seek_end(int64_t p_position = 0) = 0; ///< seek from the end of file - virtual size_t get_pos() const = 0; ///< get position in the file + virtual size_t get_position() const = 0; ///< get position in the file virtual size_t get_len() const = 0; ///< get size of the file virtual bool eof_reached() const = 0; ///< reading passed EOF @@ -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) { return FAILED; } + 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. diff --git a/core/os/input.cpp b/core/os/input.cpp index 65752662d7..a4b82299a7 100644 --- a/core/os/input.cpp +++ b/core/os/input.cpp @@ -80,7 +80,7 @@ void Input::_bind_methods() { ClassDB::bind_method(D_METHOD("get_mouse_button_mask"), &Input::get_mouse_button_mask); ClassDB::bind_method(D_METHOD("set_mouse_mode", "mode"), &Input::set_mouse_mode); ClassDB::bind_method(D_METHOD("get_mouse_mode"), &Input::get_mouse_mode); - ClassDB::bind_method(D_METHOD("warp_mouse_pos", "to"), &Input::warp_mouse_pos); + ClassDB::bind_method(D_METHOD("warp_mouse_position", "to"), &Input::warp_mouse_position); ClassDB::bind_method(D_METHOD("action_press", "action"), &Input::action_press); ClassDB::bind_method(D_METHOD("action_release", "action"), &Input::action_release); ClassDB::bind_method(D_METHOD("set_custom_mouse_cursor", "image", "hotspot"), &Input::set_custom_mouse_cursor, DEFVAL(Vector2())); diff --git a/core/os/input.h b/core/os/input.h index f98b97e647..97d3bef4f9 100644 --- a/core/os/input.h +++ b/core/os/input.h @@ -81,7 +81,7 @@ public: virtual Point2 get_last_mouse_speed() const = 0; virtual int get_mouse_button_mask() const = 0; - virtual void warp_mouse_pos(const Vector2 &p_to) = 0; + virtual void warp_mouse_position(const Vector2 &p_to) = 0; virtual Point2i warp_mouse_motion(const Ref<InputEventMouseMotion> &p_motion, const Rect2 &p_rect) = 0; virtual Vector3 get_gravity() const = 0; diff --git a/core/os/input_event.cpp b/core/os/input_event.cpp index 88037859aa..bef98ac3f2 100644 --- a/core/os/input_event.cpp +++ b/core/os/input_event.cpp @@ -781,7 +781,7 @@ void InputEventScreenTouch::_bind_methods() { ClassDB::bind_method(D_METHOD("set_index", "index"), &InputEventScreenTouch::set_index); ClassDB::bind_method(D_METHOD("get_index"), &InputEventScreenTouch::get_index); - ClassDB::bind_method(D_METHOD("set_position", "pos"), &InputEventScreenTouch::set_position); + ClassDB::bind_method(D_METHOD("set_position", "position"), &InputEventScreenTouch::set_position); ClassDB::bind_method(D_METHOD("get_position"), &InputEventScreenTouch::get_position); ClassDB::bind_method(D_METHOD("set_pressed", "pressed"), &InputEventScreenTouch::set_pressed); diff --git a/core/os/os.h b/core/os/os.h index 2fc87e44a0..38bbbc0a57 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -156,7 +156,7 @@ public: virtual void set_mouse_mode(MouseMode p_mode); virtual MouseMode get_mouse_mode() const; - virtual void warp_mouse_pos(const Point2 &p_to) {} + virtual void warp_mouse_position(const Point2 &p_to) {} virtual Point2 get_mouse_position() const = 0; virtual int get_mouse_button_state() const = 0; virtual void set_window_title(const String &p_title) = 0; |