int main() {
    char s[] = "/.../../";
    char *ans = simplifyPath(s);
    printf("%s\n", ans);
    system("pause");
    return 0;
}
Exemple #2
0
	void test() {
		vector<string> tests = {
			"/home", "/home/foo", "/home/", "/home//foo/",
			"/a/./b/../../c/",
			"/", "///", "/../"
		};
		for (string s : tests) {
			cout << s << " ==> " << simplifyPath(s) << endl;
		}
	}
    String simplifyPath (const String& path)
    {
       #if JUCE_WINDOWS
        if (path.contains ("\\..\\") || path.contains ("/../"))
       #else
        if (path.contains ("/../"))
       #endif
            return simplifyPath (path.getCharPointer());

        return path;
    }
void KarbonCalligraphicShape::updatePath(const QSizeF &size)
{
    Q_UNUSED(size);

    QPointF pos = position();

    // remove all points
    clear();
    setPosition(QPoint(0, 0));

    foreach(KarbonCalligraphicPoint *p, m_points)
    appendPointToPath(*p);

    simplifyPath();

    QList<QPointF> handles;
    foreach(KarbonCalligraphicPoint *p, m_points)
    handles.append(p->point());
    setHandles(handles);

    setPosition(pos);
}
Exemple #5
0
void testSimplifyPath(){
    string path = " ";
    string ans = simplifyPath(path);
    cout<<ans<<endl;
}
int main(int argc, char *argv[])
{
	printf("%s\n", simplifyPath(argv[1]));
	return(0);
}
	void test()
	{
		cout << simplifyPath("/a/./b/../../c/") << endl;
	}