blob: e19b1b387f53d0e33890f886cdd60a4539ab037c [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);
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);
Dees_Troy201d76b2012-11-16 17:12:02 +000030 int fixDataData(string dataDir);
bigbiff bigbiffa0f8a592012-10-09 21:01:03 -040031 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;
Dees_Troy201d76b2012-11-16 17:12:02 +000043 bool multi_user;
bigbiff bigbiffa0f8a592012-10-09 21:01:03 -040044 package* head;
45 package* temp;
46 string packageFile;
47};