add code to test thumbnail paths

This commit is contained in:
Jean-Francois Dockes 2016-06-18 19:36:57 +02:00
parent c75be77069
commit 9a61c47467

View file

@ -857,6 +857,22 @@ using namespace std;
#include "pathut.h"
void path_to_thumb(const string& _input)
{
string input(_input);
// Make absolute path if needed
if (input[0] != '/') {
input = path_absolute(input);
}
input = string("file://") + path_canon(input);
string path;
//path = url_encode(input, 7);
thumbPathForUrl(input, 7, path);
cout << path << endl;
}
const char *tstvec[] = {"", "/", "/dir", "/dir/", "/dir1/dir2",
"/dir1/dir2",
"./dir", "./dir1/", "dir", "../dir", "/dir/toto.c",
@ -955,6 +971,29 @@ int main(int argc, const char **argv)
pidfile.remove();
#endif
#if 0
if (argc > 1) {
cerr << "Usage: thumbpath <filepath>" << endl;
exit(1);
}
string input;
if (argc == 1) {
input = *argv++;
if (input.empty()) {
cerr << "Usage: thumbpath <filepath>" << endl;
exit(1);
}
path_to_thumb(input);
} else {
while (getline(cin, input)) {
path_to_thumb(input);
}
}
exit(0);
#endif
#if 0
if (argc != 1) {
cerr << "Usage: trpathut <filename>" << endl;