Searching the file system with GTSpotter

When we introduced GTSpotter, searching for files was one of the featured use cases. In this post, we take a closer look at how GTSpotter makes reaching out to various parts of the file system seamlessly integrated in Pharo.

Diving into folders

The first prerequisite for dealing with the file system is that of navigating through it. The diving mechanism of GTSpotter lends itself nicely for this purpose.

For example, searching in the current folder allows you to find a folder of interest. The preview to the right shows the contents.


Diving into it (using Cmd+Shift+Right), reveals the contents in the main window and enables further navigation.


Previewing files

The GTSpotter preview obviously allows you to take a peek not only in the contents of a folder, but also into the contents of files. For example, a text file will be shown as text.


Or a Pharo script file will be shown with proper syntax highlighting.


Relative and absolute paths

While the diving mechanism allows you to scope our search for a folder, it is also possible to enter a full path directly in the top search. Previously, we saw how starting the search with ./ triggers a search in the working directory. Adding another separator, like seen below, allows you to search through nested folders without diving.


And this works with arbitrary amount of nesting.


Of course, searching can also be triggered by the full path. This is particularly convenient when pasting a full path copied from somewhere else.


While the examples shown here work with Unix-like paths, when on Windows, GTSpotter will deal equally well with Windows paths such as .example or c:example.

Diving into zip files

One particular situation that often breaks the flow of navigation in file system tools is that of dealing with archives. Pharo comes with an off-the-shelf library that maps Zip files onto file systems, and GTSpotter takes advantage of that. For example, when selecting a Zip file, the preview shows the contents.


Diving into the file, opens the Zip archive virtually and shows its contents as if it were a plain folder. Diving and previewing works as expected.


And this includes diving into zip files nested in other zip files.



GTSpotter makes the file system easily browse-able from inside a Pharo image. Combine this with the detailed interactions offered by the GTInspector and you will transform Pharo into a powerful file system manipulation environment.

Posted by Tudor Girba at 11 March 2015, 10:43 pm link