Skip to main content
Engineering LibreTexts

2.1: Getting Started

  • Page ID
    43792
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    The framework supports different “kinds” of filesystems that are interchangeable and may transparently work with each other. The probably most common usage of FileSystem is to directly work with files stored on your hard-drive. We are going to work with that one for now.

    The class FileSystem offers factory class-methods to offer access to different filesystems. Sending the message disk to FileSystem, returns a file system as on your physical hard-drive. Sending memory creates a new file system stored in memory image.

    | working |
    working := FileSystem disk workingDirectory.
        → /Users/ducasse/Workspace/FirstCircle/Pharo/20
    
    working := FileSystem disk workingDirectory class
        → FileReference
    

    The message workingDirectory above returns a reference to the directory containing your Pharo image. A reference is an instance of the class FileReference. References are the central objects of the framework and provide the primary mechanisms for working with files and directories.

    FileSystem defines four classes that are important for the end-user: FileSystem, FileReference, FileLocator, and FileSystemDirectoryEntry. FileSystem offers factory methods to create a new file system. A FileReference is a reference to a folder or a file and offers methods to navigate and perform operations. A FileLocator is a late binding reference. When asked to perform concrete operation, a file locator looks up the current location of the origin, and resolve the path against it. A FileSystemDirectoryEntry allows one to get the additional information of a file or a directory. These classes belong to the ’FileSystem- Core’ package, and are explained below in the chapter.

    You should not use platform specific classes such as UnixStore or WindowsStore, these are internal classes. All code snippets below work on FileReference instances.


    This page titled 2.1: Getting Started is shared under a CC BY-SA 3.0 license and was authored, remixed, and/or curated by Alexandre Bergel, Damien Cassou, Stéphane Ducasse, Jannik Laval (Square Bracket Associates) via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.