summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/png/image_loader_png.cpp2
-rw-r--r--drivers/png/image_loader_png.h2
-rw-r--r--drivers/unix/dir_access_unix.cpp45
3 files changed, 24 insertions, 25 deletions
diff --git a/drivers/png/image_loader_png.cpp b/drivers/png/image_loader_png.cpp
index 33d271248c..30ec8cd036 100644
--- a/drivers/png/image_loader_png.cpp
+++ b/drivers/png/image_loader_png.cpp
@@ -201,7 +201,7 @@ Error ImageLoaderPNG::_load_image(void *rf_up, png_rw_ptr p_func, Ref<Image> p_i
return OK;
}
-Error ImageLoaderPNG::load_image(Ref<Image> p_image, FileAccess *f, bool p_force_linear) {
+Error ImageLoaderPNG::load_image(Ref<Image> p_image, FileAccess *f, bool p_force_linear, float p_scale) {
Error err = _load_image(f, _read_png_data, p_image);
f->close();
diff --git a/drivers/png/image_loader_png.h b/drivers/png/image_loader_png.h
index f0a525a9eb..c11e25e1a4 100644
--- a/drivers/png/image_loader_png.h
+++ b/drivers/png/image_loader_png.h
@@ -43,7 +43,7 @@ class ImageLoaderPNG : public ImageFormatLoader {
public:
static Error _load_image(void *rf_up, png_rw_ptr p_func, Ref<Image> p_image);
- virtual Error load_image(Ref<Image> p_image, FileAccess *f, bool p_force_linear);
+ virtual Error load_image(Ref<Image> p_image, FileAccess *f, bool p_force_linear, float p_scale);
virtual void get_recognized_extensions(List<String> *p_extensions) const;
ImageLoaderPNG();
};
diff --git a/drivers/unix/dir_access_unix.cpp b/drivers/unix/dir_access_unix.cpp
index a183a37446..cf54f3fea0 100644
--- a/drivers/unix/dir_access_unix.cpp
+++ b/drivers/unix/dir_access_unix.cpp
@@ -223,37 +223,36 @@ Error DirAccessUnix::make_dir(String p_dir) {
Error DirAccessUnix::change_dir(String p_dir) {
GLOBAL_LOCK_FUNCTION
+ p_dir = fix_path(p_dir);
- // make sure current_dir is valid absolute path
- if (current_dir == "." || current_dir == "") {
- char real_current_dir_name[2048];
- getcwd(real_current_dir_name, 2048);
- current_dir.parse_utf8(real_current_dir_name);
- }
-
- if (p_dir == ".") {
- return OK;
- }
+ char real_current_dir_name[2048];
+ getcwd(real_current_dir_name, 2048);
+ String prev_dir;
+ if (prev_dir.parse_utf8(real_current_dir_name))
+ prev_dir = real_current_dir_name; //no utf8, maybe latin?
- p_dir = fix_path(p_dir);
+ chdir(current_dir.utf8().get_data()); //ascii since this may be unicode or wathever the host os wants
+ bool worked = (chdir(p_dir.utf8().get_data()) == 0); // we can only give this utf8
- String prev_dir = current_dir;
+ String base = _get_root_path();
+ if (base != "") {
- if (p_dir.is_rel_path()) {
- String next_dir = current_dir + "/" + p_dir;
- next_dir = next_dir.simplify_path();
- current_dir = next_dir;
- } else {
- current_dir = p_dir;
+ getcwd(real_current_dir_name, 2048);
+ String new_dir;
+ new_dir.parse_utf8(real_current_dir_name);
+ if (!new_dir.begins_with(base))
+ worked = false;
}
- bool worked = (chdir(current_dir.utf8().get_data()) == 0); // we can only give this utf8
- if (!worked) {
- current_dir = prev_dir;
- return ERR_INVALID_PARAMETER;
+ if (worked) {
+
+ getcwd(real_current_dir_name, 2048);
+ if (current_dir.parse_utf8(real_current_dir_name))
+ current_dir = real_current_dir_name; //no utf8, maybe latin?
}
- return OK;
+ chdir(prev_dir.utf8().get_data());
+ return worked ? OK : ERR_INVALID_PARAMETER;
}
String DirAccessUnix::get_current_dir() {