★ wanayoo — archive 1999 https://github.com/mtxr/SublimeText-SQLTools/issues/144Nouvelle recherche | Portail wanayoo
Skip to content
This repository has been archived by the owner. It is now read-only.

Why create empty settings file on the User folder? #144

Closed
evandrocoan opened this issue Sep 30, 2017 · 2 comments
Closed

Why create empty settings file on the User folder? #144

evandrocoan opened this issue Sep 30, 2017 · 2 comments

Comments

@evandrocoan
Copy link
Contributor

@evandrocoan evandrocoan commented Sep 30, 2017

On the lines we can find it:

File: Data/Packages/SQLTools/SQLTools.py
665:     userSettingFile = os.path.join(sublimeUserFolder, SQLTOOLS_SETTINGS_FILE)
666:     if not os.path.isfile(userSettingFile):
667:         # create empty settings file in 'User' folder
668:         sublime.save_settings(SQLTOOLS_SETTINGS_FILE)

Above has the comment:

    # this ensures we have empty settings file in 'User' directory during first start
    # otherwise sublime will copy entire contents of 'SQLTools.sublime-settings'
    # which is not desirable and prevents future changes to queries and other
    # sensible defaults defined in settings file, as those would be overriden by content
    # from older versions of SQLTools in 'User\SQLTools.sublime-settings'

However I never saw Sublime Text doing such thing on version 3. Perhaps this is a fix Sublime Text version 2?

@tkopets
Copy link
Collaborator

@tkopets tkopets commented Sep 30, 2017

This change was introduced not that long ago and I think the above-mentioned Sublime Text behavior in that comment is still valid.
I believe I observed this at least on Sublime Text build 3126 - you can try to comment out or remove this line and take a look at the outcome yourself.

@tkopets tkopets closed this Oct 24, 2017
@evandrocoan
Copy link
Contributor Author

@evandrocoan evandrocoan commented Jan 7, 2019

I just tested, Sublime Text does not do that. This plugin does that:

File: Data/Packages/SQLTools/SQLToolsAPI/Storage.py
 8: class Storage:
 9:     def __init__(self, filename, default=None):
10:         self.storageFile = filename
11:         self.defaultFile = default
12:         self.items = {}
13: 
14:         # copy entire file, to keep comments
15:         if not os.path.isfile(filename) and default and os.path.isfile(default):
16:             shutil.copyfile(default, filename)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.