Sublime Forum

Projects vs Workspace: confusion

#1

This page https://www.sublimetext.com/docs/3/projects.html says that a saved Sublime 3 project has a files list and is what you would save to version control: “As a general rule, the .sublime-project file would be checked into version control”. Only if I “Project->Add folder to project” is the project file not empty. Added folders have a complete absolute path to the folders. If I commit this to version control it won’t be of use to anyone who has a different base path to the files. For one thing, my “user” name is part of the path. Is there a way to make this path relative? Have I set up something incorrectly? Thanks in advance.

BTW I bought a license to ST3 and really like it so far, though it is not always easy figuring out some of the online help instructions. For example “use the Package Manager” which I finally figure out is not a menu item but a 3rd party utility which must first be found and installed. Another: there is no “Preferences->Settings” menu per se, there are three, and none have left and right side panels. Maybe some of this is from ST2 days.

0 Likes

#2

The path that’s stored in the project doesn’t have to be absolute; it can be relative to the project file itself. Offhand I don’t know if there’s a way to automatically make directories be added that way (I created the project below by hand), but you can edit the project by picking Project > Edit Project from the menu to open it and tweak the paths as you see fit.

By way of example, on this Linux machine the project I’m working on right now has a layout that looks somewhat similar to this (I’ve constrained the tree depth and redacted some directories so that this post isn’t quite so long):

tmartin:dart:~/DataMill> tree -d -L 2
.
|-- Bin
|   `-- Binaries
|-- Config
|   `-- Web
|-- Data
|   |-- Web
|   `-- tmp
|-- DevSrc
|   |-- BootStrap
|   |-- CommonServices
|   |-- InternalDevTools
|   |-- Makefiles
|   |-- Node
|   |-- RegionalCenter
|   |-- UserNode
|   `-- Web
`-- Libs

As you can see this is the contents of a folder whose full absolute path is /home/tmartin/DataMill/ (or /Users/tmartin/DataMill if I was on a Mac). That’s the directory that the project file is saved in.

The contents of /home/tmartin/DataMill/DataMill.sublime-project looks like this:

{
    "folders":
    [
        {
            "folder_exclude_patterns": [".obj"],
            "path": "DevSrc"
        },
        {
            "folder_exclude_patterns": [".obj"],
            "path": "/home/tmartin/TestBed"
        }
    ],
    "settings":
    {
        "datamill": true
    }
}

This adds the DevSrc directory (where the source is located) to the project, but leaves all of the other parts out. At the same time I also have an absolute path of /home/tmartin/TestBed that is added to the project.

Sublime is still being actively developed, so parts of it are changing out from under the documentation. There is also some unofficial documentation which is an excellent resource of additional information.

0 Likes