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.

Relativepath.png

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

Folder-dive.png

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.

Preview-text.png

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

Preview-st.png

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.

Relativepath-withdive.png

And this works with arbitrary amount of nesting.

Deep-path.png

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

Fullpath.png

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.

Zipfile.png

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.

Inside-zip-preview.png

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

Deep-zip-file.png

Summary

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
|