sublime_text icon indicating copy to clipboard operation
sublime_text copied to clipboard

Save location for new files doesn't always make sense

Open nathanielvirgo opened this issue 6 years ago • 4 comments

Description

If I create a new project folder, then create a new file in that folder, I expect the new file to be saved in the project folder, but it isn't, it's saved in whichever folder I happened to save a file previously. This is almost always the wrong choice. It happens to me almost every time and is quite awkward to correct.

There are several previous issues with variations of this problem, but I think this one is specific and convincing enough to warrant making a change.

I'm aware that this is because Sublime Text 3 is following the OS' default behaviour (in my case OS X). However, following those defaults doesn't make sense in this specific case, because (i) the OS has no concept of a project folder, so its default behaviour doesn't take account of it, and (ii) Sublime Text 3 differs from OS default behaviour in other respects, which make this behaviour less useful than it normally would be. (I give details below.)

Steps to reproduce

  1. Create a folder /path/to/my_old_project/, open it in Sublime Text 3, create some files, and save them in it.

  2. In Finder, create another new folder at /path/to/my_new_project/

  3. In Sublime Text 3, open a new window (CMD-Shift-N), then open (CMD-O) the folder my_new_project/.

  4. Create a new file and enter some code

  5. Press CMD-S to save the new file, enter the filename my_new_file.py in the resulting file dialog, and hit 'Save'

Expected behavior

The new file is saved as /path/to/my_new_project/my_new_file.py, i.e. it's saved in the new project folder that I just created and started working on in a new window.

Actual behavior

The new file is saved as /path/to/my_old_project/my_new_file.py, i.e. it's saved in a random other folder, corresponding to the last place I happened to save a file.

In most OS X applications this wouldn't be a big deal, since I could just do File->Move To and put it in the correct location. However, in Sublime Text 3 there is no Move To item in the file menu. Consequently, having accidentally saved it in the wrong place, I have to do the following steps:

  1. Go to File -> Save As
  2. Without changing anything, make a note of which folder it's trying to save it into
  3. After making the note, manually navigate to the new project folder and save it there
  4. In Finder, navigate to the folder I just made a note of
  5. Find the newly saved file and delete it manually.

I stress again that this happens almost every time and is never what I want. If I've saved files in a given project previously, it probably does make sense to default to saving new files in that same location --- but because different windows correspond to different projects, this should be remembered on a per window basis, not globally. For a given window, if a project folder has been opened and no files have been saved previously, the default location should be the project folder.

Environment

I imagine this will happen on any build on any version of Mac OS, and possibly on other operating systems as well, but here are my specifics:

  • Build 3211
  • OS X El Capitan 10.11.6

nathanielvirgo avatar Nov 17 '19 04:11 nathanielvirgo

possible duplicate of https://github.com/SublimeTextIssues/Core/issues/236

keith-hall avatar Nov 17 '19 05:11 keith-hall

Also a duplicate of #3070, but I closed those two in favor of this issue.

FichteFoll avatar Nov 19 '19 01:11 FichteFoll

Yes please! My workaround was to type "/" in the file browser and paste the current path in, but this appears to no longer work...

At least this thread sorted out why my default path is now ~ (I must have saved there recently...)

ebarrere avatar May 01 '24 16:05 ebarrere

At least this thread sorted out why my default path is now ~ (I must have saved there recently...)

I take that back — default save location appears to ALWAYS be home now. No idea what changed, but this makes it very difficult to work...

ebarrere avatar May 01 '24 16:05 ebarrere