from 1.18 branch: Adjust things for using the new Firefox plugin: remove visible Beagle references + fix 1.18 web queue indexing bugs

This commit is contained in:
Jean-Francois Dockes
2012-11-01 11:30:39 +01:00
parent 04c19b33d5
commit 5fc8f240fe
25 changed files with 1420 additions and 1167 deletions
+24
View File
@@ -360,6 +360,26 @@ extern string path_canon(const string &is)
return ret;
}
bool makepath(const string& ipath)
{
string path = path_canon(ipath);
vector<string> elems;
stringToTokens(path, elems, "/");
path = "/";
for (vector<string>::const_iterator it = elems.begin();
it != elems.end(); it++){
path += *it;
// Not using path_isdir() here, because this cant grok symlinks
// If we hit an existing file, no worry, mkdir will just fail.
if (access(path.c_str(), 0) != 0) {
if (mkdir(path.c_str(), 0700) != 0) {
return false;
}
}
path += "/";
}
return true;
}
vector<string> path_dirglob(const string &dir, const string pattern)
{
@@ -502,6 +522,10 @@ string fileurltolocalpath(string url)
}
return url;
}
bool urlisfileurl(const string& url)
{
return url.find("file://") == 0;
}
// Printable url: this is used to transcode from the system charset
// into either utf-8 if transcoding succeeds, or url-encoded
+7 -1
View File
@@ -55,8 +55,11 @@ extern string url_encode(const string& url,
/// Transcode to utf-8 if possible or url encoding, for display.
extern bool printableUrl(const string &fcharset,
const string &in, string &out);
// Convert to file path if url is like file://
//// Convert to file path if url is like file://. This modifies the
//// input (and returns a copy for convenience)
extern string fileurltolocalpath(string url);
/// Test for file:/// url
extern bool urlisfileurl(const string& url);
/// Return the host+path part of an url. This is not a general
/// routine, it does the right thing only in the recoll context
@@ -74,6 +77,9 @@ bool fsocc(const string &path, int *pc, // Percent occupied
/// Create temporary directory
extern bool maketmpdir(string& tdir, string& reason);
/// mkdir -p
extern bool makepath(const string& path);
/// Temporary file class
class TempFileInternal {
public: