MCPcopy Create free account
hub / github.com/acl-dev/acl / get_filepath

Method get_filepath

app/iconv/charset_transfer.cpp:77–142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75}
76
77bool charset_transfer::get_filepath(acl::scan_dir& scan, const char* filename,
78 acl::string& from_filepath, acl::string& to_filepath,
79 acl::string& to_path)
80{
81 const char* rpath = scan.curr_path();
82 if (rpath == NULL)
83 {
84 logger_error("curr_path NULL, filename: %s", filename);
85 return false;
86 }
87
88 SKIP(rpath);
89 SKIP(filename);
90
91 if (*rpath == 0)
92 from_filepath << filename;
93 else
94 from_filepath << rpath << SEP << filename;
95
96#if 0
97 if (strstr(from_filepath.c_str(), ".svn") != NULL
98 || strstr(from_filepath.c_str(), ".git") != NULL
99 || strstr(from_filepath.c_str(), ".cvs") != NULL
100 || strstr(from_filepath.c_str(), ".inc") != NULL
101 || strstr(from_filepath.c_str(), ".exe") != NULL
102 || strstr(from_filepath.c_str(), ".class") != NULL
103 || strstr(from_filepath.c_str(), ".zip") != NULL
104 || strstr(from_filepath.c_str(), ".rar") != NULL
105 || strstr(from_filepath.c_str(), ".tar") != NULL
106 || strstr(from_filepath.c_str(), ".tar.gz") != NULL
107 || strstr(from_filepath.c_str(), ".tgz") != NULL
108 || strstr(from_filepath.c_str(), ".bzip2") != NULL
109 || strstr(from_filepath.c_str(), ".o") != NULL)
110 {
111 logger("skip %s", from_filepath.c_str());
112 return false;
113 }
114#else
115 static const char* files_ext[] = {
116 ".c",
117 ".h",
118 ".cpp",
119 ".hpp",
120 ".cxx",
121 ".hxx",
122 NULL,
123 };
124
125 bool match = false;
126 for (int i = 0; files_ext[i] != NULL; i++)
127 {
128 if (from_filepath.rncompare(files_ext[i],
129 strlen(files_ext[i]), false) == 0)
130 {
131 match = true;
132 break;
133 }
134 }

Callers

nothing calls this directly

Calls 3

curr_pathMethod · 0.80
rncompareMethod · 0.80
c_strMethod · 0.45

Tested by

no test coverage detected