summaryrefslogtreecommitdiff
path: root/platform/flash/dir_access_flash.h
blob: 1378a6e56f247d372482f0fb5d544f4752780080 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*************************************************/
/*  dir_access_psp.h                             */
/*************************************************/
/*            This file is part of:              */
/*                GODOT ENGINE                   */
/*************************************************/
/*       Source code within this file is:        */
/*  (c) 2007-2010 Juan Linietsky, Ariel Manzur   */
/*             All Rights Reserved.              */
/*************************************************/

#ifndef DIR_ACCESS_FLASH_H
#define DIR_ACCESS_FLASH_H

#include "core/os/dir_access.h"

#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <dirent.h>

class DirAccessFlash : public DirAccess {

	DIR *dir_stream;

	String current_dir;
	bool _cisdir;

	static DirAccess* create_flash();

public:

	bool list_dir_begin(); ///< This starts dir listing
	String get_next();
	bool current_is_dir() const;

	void list_dir_end(); ///<

	int get_drive_count();
	String get_drive(int p_drive);

	Error change_dir(String p_dir); ///< can be relative or absolute, return false on success
	String get_current_dir(); ///< return current dir location

	Error make_dir(String p_dir);

	bool file_exists(String p_file);
	bool dir_exists(String p_dir);

	size_t get_space_left();

	uint64_t get_modified_time(String p_file);

	Error rename(String p_from, String p_to);
	Error remove(String p_name);

	static void make_default();

	DirAccessFlash();
	~DirAccessFlash();
};

#endif // DIR_ACCESS_PSP_H