3 import "ExplorerWindow"
17 DummyFileSystemCacheWindow dw;// { size = { 200, 200 } };
20 class Explorer : GuiApplication
26 int c, argc = this.argc;
27 int openArgsStartAt = 0;
28 QuickPathTool searchPath { };
29 char * findWhat = null;
30 Array<String> comparedPaths = null;
32 SetLoggingMode(debug, null);
34 for(c = 1; c < argc; c++)
36 if(!strcmp(argv[c], "#"))
45 if(!strcmpi(argv[1], "go") && argc > 2)
47 else if(!strcmpi(argv[1], "find") && argc > 2)
50 if(argv[2][0] == '\"')
51 StripQuotes(argv[2], unquoted);
54 findWhat = CopyString(unquoted);
57 if(!strcmpi(argv[3], "in") && argc > 4)
60 searchPath = ""; // this should make it current dir
63 searchPath = ""; // same
65 else if(!strcmpi(argv[1], "search") && argc > 2)
67 else if(!strcmpi(argv[1], "compare") && argc > 2)
69 QuickPathTool goPath { };
73 goPath = ""; // current dir
74 comparedPaths.Add(goPath);
76 for(c = 2; c < argc; c++)
82 comparedPaths.Add(CopyString(s));
84 if(comparedPaths.count < 2)
85 PrintLn("compare requires at least 2 existing directories to work.");
87 else if(!strcmpi(argv[1], "image") && argc > 2)
89 else if(!strcmpi(argv[1], "slides") && argc > 2)
99 QuickPathTool goPath { };
100 for(c = openArgsStartAt; c < argc; c++)
102 goPath = openArgsStartAt == -1 ? "" : argv[c];
108 //Map<String, bool> linksPaths { };
109 //Map<uint, Map<uint, bool>> devsInodesDone { };
110 //FileSystemCache cache;
111 // dw = { visible = false };
112 ///*cache = */FileSystemCache::Cache("/", true, dw);
114 // FileSystemCache::Cache("/s1", true, false, true, dw);
115 // FileSystemCache::Cache("/s2/0z", true, false, true, dw);
116 //dw.cache.Special("/s2/0z/0sort", dw);
117 //dw.cache.Special("/s2/library", dw);
118 //dw.cache.Special("/s2/mirror", dw);
119 // dw.cache.SpecialPrint();
120 //devsInodesDone.Free();
121 //delete devsInodesDone;
124 ExplorerWindow explorerWnd { testCache = dw.cache };
125 explorerWnd.Create();
126 explorerWnd.location = goPath;//explorerWnd.GoTo(goPath, false, false);
128 // PrintLn("# of objects: ", dw.cache.objects.count);
129 // PrintLn("# of non single file sizes: ", dw.cache.nonSingleSizes.count);
134 ExplorerWindow explorerWnd { };
135 explorerWnd.Create();
136 explorerWnd.location = goPath;//explorerWnd.GoTo(goPath, false, false);
143 ExplorerWindow explorerWnd { };
144 explorerWnd.Create();
145 //explorerWnd.SearchLocation(searchPath);
147 else if(comparedPaths && comparedPaths.count > 1)
149 // compare /s1/library/dummies /s1/library/movies /s1/oldlib/movies "/home/redj/.gvfs/d02-2tb on kimji/library/movies"
150 ExplorerWindow explorerWnd { };
151 explorerWnd.Create();
152 explorerWnd.view.columnsCompareStyle = true;
153 explorerWnd.comparedLocations = comparedPaths;
154 // delete comparedPaths;
162 char path[MAX_LOCATION];
169 GetWorkingDir(path, MAX_LOCATION);
171 StripQuotes(value, unquoted);
174 PathCat(path, unquoted);
175 if(!FileExists(path))
177 // this incomplete functionality is not quite at it's place in this class
179 char * original = CopyString(path);
180 while((len = strlen(path)))
182 StripLastDirectory(path, path);
185 // TODO: message location does not exist,
186 // this higher location exists though
193 // TODO: message location does not exist,
194 // unable to select alternate location
200 get { return path[0] ? (char*)path : null; }
202 property bool { get { return path[0] != '\0'; } }
205 define app = ((Explorer)__thisModule);