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); |
bigbiff bigbiff | a0f8a59 | 2012-10-09 21:01:03 -0400 | [diff] [blame] | 25 | int getPackages(); |
| 26 | int fixSystemApps(); |
| 27 | int fixDataApps(); |
| 28 | int fixAllFiles(string directory, int gid, int uid, string file_perms); |
Dees_Troy | 201d76b | 2012-11-16 17:12:02 +0000 | [diff] [blame] | 29 | int fixDataData(string dataDir); |
bigbiff bigbiff | a0f8a59 | 2012-10-09 21:01:03 -0400 | [diff] [blame] | 30 | struct package { |
| 31 | string pkgName; |
| 32 | string codePath; |
| 33 | string appDir; |
| 34 | string app; |
| 35 | string dDir; |
| 36 | int gid; |
| 37 | int uid; |
| 38 | package *next; |
| 39 | }; |
| 40 | bool debug; |
| 41 | bool remove_data; |
Dees_Troy | 201d76b | 2012-11-16 17:12:02 +0000 | [diff] [blame] | 42 | bool multi_user; |
bigbiff bigbiff | a0f8a59 | 2012-10-09 21:01:03 -0400 | [diff] [blame] | 43 | package* head; |
| 44 | package* temp; |
| 45 | string packageFile; |
| 46 | }; |