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)
49 if(argv[2][0] == '\"')
51 findWhat = new char[strlen(argv[2])+1];
52 StripQuotes(argv[2], findWhat);
55 findWhat = CopyString(argv[2]);
58 if(!strcmpi(argv[3], "in") && argc > 4)
61 searchPath = ""; // this should make it current dir
64 searchPath = ""; // same
66 else if(!strcmpi(argv[1], "search") && argc > 2)
68 else if(!strcmpi(argv[1], "compare") && argc > 2)
70 QuickPathTool goPath { };
74 goPath = ""; // current dir
75 comparedPaths.Add(CopyString((const char *)goPath)); // TODO: Review whether this gets freed?
77 for(c = 2; c < argc; c++)
83 comparedPaths.Add(CopyString(s));
85 if(comparedPaths.count < 2)
86 PrintLn("compare requires at least 2 existing directories to work.");
88 else if(!strcmpi(argv[1], "image") && argc > 2)
90 else if(!strcmpi(argv[1], "slides") && argc > 2)
100 QuickPathTool goPath { };
101 for(c = openArgsStartAt; c < argc; c++)
103 goPath = openArgsStartAt == -1 ? "" : argv[c];
106 ExplorerWindow explorerWnd { };
107 explorerWnd.Create();
108 explorerWnd.location = goPath;//explorerWnd.GoTo(goPath, false, false);
110 if(openArgsStartAt == -1)
116 ExplorerWindow explorerWnd { };
117 explorerWnd.Create();
118 //explorerWnd.SearchLocation(searchPath);
120 else if(comparedPaths && comparedPaths.count > 1)
122 // compare /s1/library/dummies /s1/library/movies /s1/oldlib/movies "/home/redj/.gvfs/d02-2tb on kimji/library/movies"
123 ExplorerWindow explorerWnd { };
124 explorerWnd.Create();
125 explorerWnd.view.columnsCompareStyle = true;
126 explorerWnd.comparedLocations = comparedPaths;
127 comparedPaths = null;
128 // delete comparedPaths;
132 comparedPaths.Free();
133 delete comparedPaths;
141 char path[MAX_LOCATION];
143 property const char *
147 GetWorkingDir(path, MAX_LOCATION);
150 char * unquoted = new char[strlen(value) + 1];
151 StripQuotes(value, unquoted);
152 PathCat(path, unquoted);
156 PathCat(path, value);
157 if(!FileExists(path))
159 // this incomplete functionality is not quite at it's place in this class
161 char * original = CopyString(path);
162 while((len = strlen(path)))
164 StripLastDirectory(path, path);
167 // TODO: message location does not exist,
168 // this higher location exists though
175 // TODO: message location does not exist,
176 // unable to select alternate location
182 get { return path[0] ? (char*)path : null; }
184 property bool { get { return path[0] != '\0'; } }
187 define app = ((Explorer)__thisModule);