blob: 491029a62f289ef5b86e7bba50ef8c5f5ae5a37b [file] [log] [blame]
bigbiff bigbiffa0f8a592012-10-09 21:01:03 -04001#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
14using namespace std;
15
16class 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 bigbiffa0f8a592012-10-09 21:01:03 -040025 int getPackages();
26 int fixSystemApps();
27 int fixDataApps();
28 int fixAllFiles(string directory, int gid, int uid, string file_perms);
Dees_Troy201d76b2012-11-16 17:12:02 +000029 int fixDataData(string dataDir);
bigbiff bigbiffa0f8a592012-10-09 21:01:03 -040030 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_Troy201d76b2012-11-16 17:12:02 +000042 bool multi_user;
bigbiff bigbiffa0f8a592012-10-09 21:01:03 -040043 package* head;
44 package* temp;
45 string packageFile;
46};