Merge pull request #20889 from godotengine/revert-18914-master

Revert "added get_creation_time function for gdscript"
This commit is contained in:
Juan Linietsky 2018-08-10 13:30:00 -03:00 committed by GitHub
commit 767fb2fa0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 0 additions and 133 deletions

View File

@ -1872,12 +1872,6 @@ uint64_t _File::get_modified_time(const String &p_file) const {
return FileAccess::get_modified_time(p_file);
}
// NEW FUNCTION
uint64_t _File::get_creation_time(const String &p_file) const {
return FileAccess::get_creation_time(p_file);
}
void _File::_bind_methods() {
ClassDB::bind_method(D_METHOD("open_encrypted", "path", "mode_flags", "key"), &_File::open_encrypted);
@ -1929,7 +1923,6 @@ void _File::_bind_methods() {
ClassDB::bind_method(D_METHOD("file_exists", "path"), &_File::file_exists);
ClassDB::bind_method(D_METHOD("get_modified_time", "file"), &_File::get_modified_time);
ClassDB::bind_method(D_METHOD("get_creation_time", "file"), &_File::get_creation_time); // NEW FUNCTION
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "endian_swap"), "set_endian_swap", "get_endian_swap");
@ -2130,7 +2123,6 @@ void _Directory::_bind_methods() {
ClassDB::bind_method(D_METHOD("file_exists", "path"), &_Directory::file_exists);
ClassDB::bind_method(D_METHOD("dir_exists", "path"), &_Directory::dir_exists);
//ClassDB::bind_method(D_METHOD("get_modified_time","file"),&_Directory::get_modified_time);
//ClassDB::bind_method(D_METHOD("get_creation_time","file"),&_Directory::get_creation_time); // NEW FUNCTION
ClassDB::bind_method(D_METHOD("get_space_left"), &_Directory::get_space_left);
ClassDB::bind_method(D_METHOD("copy", "from", "to"), &_Directory::copy);
ClassDB::bind_method(D_METHOD("rename", "from", "to"), &_Directory::rename);

View File

@ -485,7 +485,6 @@ public:
bool file_exists(const String &p_name) const; ///< return true if a file exists
uint64_t get_modified_time(const String &p_file) const;
uint64_t get_creation_time(const String &p_file) const; // NEW FUNCTION
_File();
virtual ~_File();

View File

@ -143,12 +143,6 @@ public:
return f._get_modified_time(p_file);
}
// NEW FUNCTION
virtual uint64_t _get_creation_time(const String &p_file) {
return f._get_creation_time(p_file);
}
FileAccessBufferedFA(){
};

View File

@ -372,15 +372,6 @@ uint64_t FileAccessCompressed::_get_modified_time(const String &p_file) {
return 0;
}
// NEW FUNCTION
uint64_t FileAccessCompressed::_get_creation_time(const String &p_file) {
if (f)
return f->get_creation_time(p_file);
else
return 0;
}
FileAccessCompressed::FileAccessCompressed() {
f = NULL;

View File

@ -91,7 +91,6 @@ public:
virtual bool file_exists(const String &p_name); ///< return true if a file exists
virtual uint64_t _get_modified_time(const String &p_file);
virtual uint64_t _get_creation_time(const String &p_file);// NEW FUNCTION
FileAccessCompressed();
virtual ~FileAccessCompressed();

View File

@ -302,12 +302,6 @@ uint64_t FileAccessEncrypted::_get_modified_time(const String &p_file) {
return 0;
}
// NEW FUNCTION
uint64_t FileAccessEncrypted::_get_creation_time(const String &p_file) {
return 0;
}
FileAccessEncrypted::FileAccessEncrypted() {
file = NULL;

View File

@ -79,7 +79,6 @@ public:
virtual bool file_exists(const String &p_name); ///< return true if a file exists
virtual uint64_t _get_modified_time(const String &p_file);
virtual uint64_t _get_creation_time(const String &p_file); // NEW FUNCTION
FileAccessEncrypted();
~FileAccessEncrypted();

View File

@ -70,7 +70,6 @@ public:
virtual bool file_exists(const String &p_name); ///< return true if a file exists
virtual uint64_t _get_modified_time(const String &p_file) { return 0; }
virtual uint64_t _get_creation_time(const String &p_file) { return 0; } // NEW FUNCTION
FileAccessMemory();
};

View File

@ -498,24 +498,6 @@ uint64_t FileAccessNetwork::_get_modified_time(const String &p_file) {
return exists_modtime;
}
// NEW FUNCTION
uint64_t FileAccessNetwork::_get_creation_time(const String &p_file) {
FileAccessNetworkClient *nc = FileAccessNetworkClient::singleton;
nc->lock_mutex();
nc->put_32(id);
nc->put_32(COMMAND_GET_MODTIME);
CharString cs = p_file.utf8();
nc->put_32(cs.length());
nc->client->put_data((const uint8_t *)cs.ptr(), cs.length());
nc->unlock_mutex();
DEBUG_PRINT("MODTIME POST");
nc->sem->post();
sem->wait();
return exists_modtime;
}
void FileAccessNetwork::configure() {
GLOBAL_DEF("network/remote_fs/page_size", 65536);

View File

@ -162,7 +162,6 @@ public:
virtual bool file_exists(const String &p_path); ///< return true if a file exists
virtual uint64_t _get_modified_time(const String &p_file);
virtual uint64_t _get_creation_time(const String &p_file); // NEW FUNCTION
static void configure();

View File

@ -142,7 +142,6 @@ class FileAccessPack : public FileAccess {
FileAccess *f;
virtual Error _open(const String &p_path, int p_mode_flags);
virtual uint64_t _get_modified_time(const String &p_file) { return 0; }
virtual uint64_t _get_creation_time(const String &p_file) { return 0; } // NEW FUNCTION
public:
virtual void close();

View File

@ -114,7 +114,6 @@ public:
virtual bool file_exists(const String &p_name); ///< return true if a file exists
virtual uint64_t _get_modified_time(const String &p_file) { return 0; } // todo
virtual uint64_t _get_creation_time(const String &p_file) { return 0; } // NEW FUNCTION
FileAccessZip(const String &p_path, const PackedData::PackedFile &p_file);
~FileAccessZip();

View File

@ -231,7 +231,6 @@ RES ResourceLoader::load(const String &p_path, const String &p_type_hint, bool p
res->set_edited(false);
if (timestamp_on_load) {
uint64_t mt = FileAccess::get_modified_time(path);
uint64_t ct = FileAccess::get_creation_time(path); // NEW FUNCTION
//printf("mt %s: %lli\n",remapped_path.utf8().get_data(),mt);
res->set_last_modified_time(mt);
}

View File

@ -80,7 +80,6 @@ Error ResourceSaver::save(const String &p_path, const RES &p_resource, uint32_t
((Resource *)p_resource.ptr())->set_edited(false);
if (timestamp_on_save) {
uint64_t mt = FileAccess::get_modified_time(p_path);
uint64_t ct = FileAccess::get_creation_time(p_path); // NEW FUNCTION
((Resource *)p_resource.ptr())->set_last_modified_time(mt);
}

View File

@ -488,19 +488,6 @@ uint64_t FileAccess::get_modified_time(const String &p_file) {
memdelete(fa);
return mt;
}
// NEW FUNCTION
uint64_t FileAccess::get_creation_time(const String &p_file) {
if (PackedData::get_singleton() && !PackedData::get_singleton()->is_disabled() && PackedData::get_singleton()->has_path(p_file))
return 0;
FileAccess *fa = create_for_path(p_file);
ERR_FAIL_COND_V(!fa, 0);
uint64_t ct = fa->_get_creation_time(p_file);
memdelete(fa);
return ct;
}
void FileAccess::store_string(const String &p_string) {

View File

@ -59,7 +59,6 @@ protected:
String fix_path(const String &p_path) const;
virtual Error _open(const String &p_path, int p_mode_flags) = 0; ///< open a file
virtual uint64_t _get_modified_time(const String &p_file) = 0;
virtual uint64_t _get_creation_time(const String &p_file) = 0; // NEW FUNCTION
static FileCloseFailNotify close_fail_notify;
@ -154,7 +153,6 @@ public:
static CreateFunc get_create_func(AccessType p_access);
static bool exists(const String &p_name); ///< return true if a file exists
static uint64_t get_modified_time(const String &p_file);
static uint64_t get_creation_time(const String &p_file); // NEW FUNCTION
static void set_backup_save(bool p_enable) { backup_save = p_enable; };
static bool is_backup_save_enabled() { return backup_save; };

View File

@ -124,26 +124,6 @@ uint64_t DirAccessUnix::get_modified_time(String p_file) {
return 0;
};
// NEW FUNCTION
uint64_t DirAccessUnix::get_creation_time(String p_file) {
if (p_file.is_rel_path())
p_file = current_dir.plus_file(p_file);
p_file = fix_path(p_file);
struct stat flags;
bool success = (stat(p_file.utf8().get_data(), &flags) == 0);
if (success) {
return flags.st_ctime;
} else {
ERR_FAIL_V(0);
};
return 0;
};
String DirAccessUnix::get_next() {
if (!dir_stream)

View File

@ -75,7 +75,6 @@ public:
virtual bool dir_exists(String p_dir);
virtual uint64_t get_modified_time(String p_file);
virtual uint64_t get_creation_time(String p_file); // NEW FUNCTION
virtual Error rename(String p_path, String p_new_path);
virtual Error remove(String p_path);

View File

@ -297,22 +297,6 @@ uint64_t FileAccessUnix::_get_modified_time(const String &p_file) {
};
}
// NEW FUNCTION
uint64_t FileAccessUnix::_get_creation_time(const String &p_file) {
String file = fix_path(p_file);
struct stat flags;
int err = stat(file.utf8().get_data(), &flags);
if (!err) {
return flags.st_ctime;
} else {
print_line("ERROR IN: " + p_file);
ERR_FAIL_V(0);
};
}
Error FileAccessUnix::_chmod(const String &p_path, int p_mod) {
int err = chmod(p_path.utf8().get_data(), p_mod);
if (!err) {

View File

@ -84,7 +84,6 @@ public:
virtual bool file_exists(const String &p_path); ///< return true if a file exists
virtual uint64_t _get_modified_time(const String &p_file);
virtual uint64_t _get_creation_time(const String &p_file); // NEW FUNCTION
virtual Error _chmod(const String &p_path, int p_mod);

View File

@ -311,26 +311,6 @@ uint64_t FileAccessWindows::_get_modified_time(const String &p_file) {
ERR_FAIL_V(0);
};
// NEW FUNCTION
uint64_t FileAccessWindows::_get_creation_time(const String &p_file) {
String file = fix_path(p_file);
if (file.ends_with("/") && file != "/")
file = file.substr(0, file.length() - 1);
struct _stat st;
int rv = _wstat(file.c_str(), &st);
if (rv == 0) {
return st.st_ctime;
} else {
print_line("no access to " + file);
}
ERR_FAIL_V(0);
};
FileAccessWindows::FileAccessWindows() {
f = NULL;

View File

@ -77,7 +77,6 @@ public:
virtual bool file_exists(const String &p_name); ///< return true if a file exists
uint64_t _get_modified_time(const String &p_file);
uint64_t _get_creation_time(const String &p_file); // NEW FUNCTION
FileAccessWindows();
virtual ~FileAccessWindows();

View File

@ -77,7 +77,6 @@ class GDMonoAssembly {
String name;
String path;
uint64_t modified_time;
uint64_t creation_time; // NEW FUNCTION
HashMap<ClassKey, GDMonoClass *, ClassKey::Hasher> cached_classes;
Map<MonoClass *, GDMonoClass *> cached_raw;
@ -117,7 +116,6 @@ public:
_FORCE_INLINE_ String get_name() const { return name; }
_FORCE_INLINE_ String get_path() const { return path; }
_FORCE_INLINE_ uint64_t get_modified_time() const { return modified_time; }
_FORCE_INLINE_ uint64_t get_creation_time() const { return creation_time; } // NEW FUNCTION
GDMonoClass *get_class(const StringName &p_namespace, const StringName &p_name);
GDMonoClass *get_class(MonoClass *p_mono_class);

View File

@ -70,7 +70,6 @@ public:
virtual bool file_exists(const String &p_path); ///< return true if a file exists
virtual uint64_t _get_modified_time(const String &p_file) { return 0; }
virtual uint64_t _get_creation_time(const String &p_file) { return 0; } // NEW FUNCTION
//static void make_default();