blob: 45c04712ccc71774d3a472c50f0185cdc0983fd3 [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);
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};