X-Git-Url: http://ecere.com/cgi-bin/gitweb.cgi?p=ede;a=blobdiff_plain;f=explorer%2Fsrc%2FExplorer.ec;h=58c86a2080df8e2ef7198e22e498d5803eeed404;hp=2f447f802d3babefee603c07d73a0a6795dfd3e9;hb=31c0bbb5b1181eb99fd55eba92dacb2ed14b3fb2;hpb=36c3b8012682a36987d0cbeb2399fe003cf7622f diff --git a/explorer/src/Explorer.ec b/explorer/src/Explorer.ec index 2f447f8..58c86a2 100644 --- a/explorer/src/Explorer.ec +++ b/explorer/src/Explorer.ec @@ -14,20 +14,36 @@ import "ExplorerWindow" #endif */ +DummyFileSystemCacheWindow dw;// { size = { 200, 200 } }; + + class Explorer : GuiApplication { //skin = "Acovel"; bool Init() { - QuickPathTool goPath { }; + int c, argc = this.argc; + int openArgsStartAt = 0; QuickPathTool searchPath { }; char * findWhat = null; + Array comparedPaths = null; + SetLoggingMode(debug, null); + + for(c = 1; c < argc; c++) + { + if(!strcmp(argv[c], "#")) + { + argc = c; + break; + } + } + if(argc > 1) { if(!strcmpi(argv[1], "go") && argc > 2) - goPath = argv[2]; + openArgsStartAt = 2; else if(!strcmpi(argv[1], "find") && argc > 2) { char * unquoted; @@ -48,20 +64,79 @@ class Explorer : GuiApplication } else if(!strcmpi(argv[1], "search") && argc > 2) searchPath = argv[2]; + else if(!strcmpi(argv[1], "compare") && argc > 2) + { + QuickPathTool goPath { }; + comparedPaths = { }; + if(argc == 3) + { + goPath = ""; // current dir + comparedPaths.Add(goPath); + } + for(c = 2; c < argc; c++) + { + char * s; + goPath = argv[c]; + s = goPath; + if(s) + comparedPaths.Add(CopyString(s)); + } + if(comparedPaths.count < 2) + PrintLn("compare requires at least 2 existing directories to work."); + } else if(!strcmpi(argv[1], "image") && argc > 2) ; else if(!strcmpi(argv[1], "slides") && argc > 2) ; else - goPath = argv[1]; + openArgsStartAt = 1; } else - goPath = ""; - if(goPath) + openArgsStartAt = -1; + + if(openArgsStartAt) { - ExplorerWindow explorerWnd { }; - explorerWnd.Create(); - //explorerWnd.GoToLocation(goPath); + QuickPathTool goPath { }; + for(c = openArgsStartAt; c < argc; c++) + { + goPath = openArgsStartAt == -1 ? "" : argv[c]; + if(goPath) + { + if(false)//(c == 1) + { + FileStats stats; + //Map linksPaths { }; + //Map> devsInodesDone { }; + //FileSystemCache cache; + // dw = { visible = false }; + ///*cache = */FileSystemCache::Cache("/", true, dw); + + // FileSystemCache::Cache("/s1", true, false, true, dw); + // FileSystemCache::Cache("/s2/0z", true, false, true, dw); + //dw.cache.Special("/s2/0z/0sort", dw); + //dw.cache.Special("/s2/library", dw); + //dw.cache.Special("/s2/mirror", dw); + // dw.cache.SpecialPrint(); + //devsInodesDone.Free(); + //delete devsInodesDone; + + /*{ + ExplorerWindow explorerWnd { testCache = dw.cache }; + explorerWnd.Create(); + explorerWnd.location = goPath;//explorerWnd.GoTo(goPath, false, false); + }*/ + // PrintLn("# of objects: ", dw.cache.objects.count); + // PrintLn("# of non single file sizes: ", dw.cache.nonSingleSizes.count); + // delete dw; + } + else + { + ExplorerWindow explorerWnd { }; + explorerWnd.Create(); + explorerWnd.location = goPath;//explorerWnd.GoTo(goPath, false, false); + } + } + } } else if(searchPath) { @@ -69,6 +144,15 @@ class Explorer : GuiApplication explorerWnd.Create(); //explorerWnd.SearchLocation(searchPath); } + else if(comparedPaths && comparedPaths.count > 1) + { + // compare /s1/library/dummies /s1/library/movies /s1/oldlib/movies "/home/redj/.gvfs/d02-2tb on kimji/library/movies" + ExplorerWindow explorerWnd { }; + explorerWnd.Create(); + explorerWnd.view.columnsCompareStyle = true; + explorerWnd.comparedLocations = comparedPaths; + // delete comparedPaths; + } return true; } } @@ -113,9 +197,9 @@ struct QuickPathTool delete original; } } - get { return path[0] ? path : null; } + get { return path[0] ? (char*)path : null; } } - property bool { get { return (bool)path[0]; } } + property bool { get { return path[0] != '\0'; } } }; define app = ((Explorer)__thisModule);