bigbiff bigbiff | a0f8a59 | 2012-10-09 21:01:03 -0400 | [diff] [blame] | 1 | #include <iostream> |
| 2 | #include <fstream> |
| 3 | #include <sstream> |
| 4 | #include <string> |
| 5 | #include <vector> |
| 6 | #include <string.h> |
| 7 | #include <libgen.h> |
| 8 | #include <unistd.h> |
| 9 | #include <sys/stat.h> |
| 10 | #include <dirent.h> |
| 11 | #include "gui/rapidxml.hpp" |
| 12 | #include "twrp-functions.hpp" |
| 13 | |
| 14 | using namespace std; |
| 15 | |
| 16 | class fixPermissions { |
| 17 | public: |
| 18 | int fixPerms(bool enable_debug, bool remove_data_for_missing_apps); |
| 19 | |
| 20 | private: |
| 21 | int pchown(std::string fn, int puid, int pgid); |
| 22 | int pchmod(std::string fn, string mode); |
| 23 | vector <string> listAllDirectories(std::string path); |
| 24 | vector <string> listAllFiles(std::string path); |
| 25 | int removeDir(const std::string path); |
| 26 | int getPackages(); |
| 27 | int fixSystemApps(); |
| 28 | int fixDataApps(); |
| 29 | int fixAllFiles(string directory, int gid, int uid, string file_perms); |
| 30 | int fixDataData(); |
| 31 | struct package { |
| 32 | string pkgName; |
| 33 | string codePath; |
| 34 | string appDir; |
| 35 | string app; |
| 36 | string dDir; |
| 37 | int gid; |
| 38 | int uid; |
| 39 | package *next; |
| 40 | }; |
| 41 | bool debug; |
| 42 | bool remove_data; |
| 43 | package* head; |
| 44 | package* temp; |
| 45 | string packageFile; |
| 46 | }; |