diff options
author | Anton Yabchinskiy <arn@bestmx.ru> | 2015-07-29 23:01:36 +0300 |
---|---|---|
committer | Anton Yabchinskiy <arn@bestmx.ru> | 2015-07-29 23:01:36 +0300 |
commit | dc8df8a91a995796f0f330bf6bb6b209f6dfce08 (patch) | |
tree | 46cfe09124703b07860754d6b44e0289422e0573 /core/os/dir_access.cpp | |
parent | 16746f157f83d666079ba3266acec13d35b84c3f (diff) | |
parent | 922356b903061cda7591090bf19e8346c3a78cf5 (diff) |
Merge branch 'master' of github.com:okamstudio/godot
Diffstat (limited to 'core/os/dir_access.cpp')
-rw-r--r-- | core/os/dir_access.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/core/os/dir_access.cpp b/core/os/dir_access.cpp index 53fe792c46..d0baae5872 100644 --- a/core/os/dir_access.cpp +++ b/core/os/dir_access.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -56,6 +56,17 @@ String DirAccess::_get_root_string() const { return ""; } +int DirAccess::get_current_drive() { + + String path = get_current_dir().to_lower(); + for(int i=0;i<get_drive_count();i++) { + String d = get_drive(i).to_lower(); + if (path.begins_with(d)) + return i; + } + + return 0; +} static Error _erase_recursive(DirAccess *da) { @@ -399,6 +410,15 @@ Error DirAccess::copy(String p_from,String p_to) { return err; } +bool DirAccess::exists(String p_dir) { + + DirAccess* da = DirAccess::create_for_path(p_dir); + bool valid = da->change_dir(p_dir)==OK; + memdelete(da); + return valid; + +} + DirAccess::DirAccess(){ _access_type=ACCESS_FILESYSTEM; |