Sublime Forum

Cross Platform Project Files ($HOME?)

#1

I’m using Sublime Text on Linux, OSX, and Windows.
I sync my configs without problems, but my projects I have to manually build on each system.

On each linux and OSX I store the projects in:

$HOME/Documents/Projects/<PROJECTNAME>

On windows I store the projects in:

 %HOMEPATH%/Documents/Project/<PROJECTNAME>

I’m not doing anything crazy in the project files, they are as basic as:

{
    "folders":
    
        {
            "follow_symlinks": true,
            "path": "/home/oxsyn/Documents/Projects/Sandbox"
        }
    ]
}

I’ve tried mucking around with placing variables in the configs, nothing seems to work.
Anyone have any ideas?

0 Likes

#2

I had the same problem and did a python script that works like a charm.
It should be run from the project main directory.

================================================================
#!/usr/bin/env python

-- coding: utf-8 --

imports

import os
from sys import platform

CWD = os.path.dirname(os.path.realpath(file))
projectname = ‘partyland’

def rutaos():
file = open(’%s.sublime-project’ % projectname, ‘w’)

# ruta = os.path.join(CWD, projectname)
ruta = CWD
if 'win32' in platform:
    ruta = ruta.replace('\\', '/')
file.write(('{\n "folders":\n\t\n\t\t{\n\t\t\t"file_exclude_patterns":'
    '\n\t\t\t\n\t\t\t\t".*",\n\t\t\t\t"*.js",\n\t\t\t\t"*.png",'
    '\n\t\t\t\t"*.ico", \n\t\t\t\t"*.gif",\n\t\t\t\t"*.jpg",\n\t\t\t\t"'
    '*.jPG",\n\t\t\t\t"*.jpeg",\n\t\t\t\t"*.po",\n\t\t\t\t"*.mo"'
    '\n\t\t\t],\n\t\t\t"folder_exclude_patterns":\n\t\t\t\n\t\t\t\t".'
    'ropeproject",\n\t\t\t\t".git",\n\t\t\t\t".SyncArchive",\n\t\t\t\t"'
    'Imagenes",\n\t\t\t\t"tiendas",\n\t\t\t\t"productos"\n\t\t\t],'
    '\n\t\t\t"path": "%s"\n\t\t}\n\t]\n }') % ruta)
file.close()

if 'win32' in platform:
    file = open('C:\\Users\\my_user\\sync\\ST3_user\\'
        'Anaconda.sublime-settings', 'w')
    interprete = 'C:\\\\Python27\\\\python.exe'
else:
    file = open(('/home/%s/sync/ST3_user/Anaconda.sublime-settings'
        ) % os.environ'USER'], 'w')
    interprete = '/usr/bin/python'
file.write(('{\n\t"python_interpreter": "%s",\n\t"pep8_ignore" :\n\t'
    '\t\n\t\t"E127",\n\t\t"E128",\n\t\t"E124",\n\t\t"E126",\n\t\t],\n\t"'
    'anaconda_gutter_marks": true,\n\t"complete_parameters": true,\n\t'
    '"display_signatures": true\n}') % interprete)
file.close()

if name == ‘main’:
rutaos()

even if you dont know anything about python its very easy to set to your requerements

0 Likes

#3

If your paths relative to the project directory are all the same (which I’m guessing they are), have you tried just specifying relative paths rather than absolute?

0 Likes