Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prefer bin path one up from SCVim.sc #69

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 28 additions & 17 deletions sc/SCVim.sc
Original file line number Diff line number Diff line change
Expand Up @@ -42,33 +42,44 @@ SCVim {
};

StartUp.add {
var classList, file, hugeString = "syn keyword scObject", basePath;
var classList, file, hugeString = "syn keyword scObject", basePath, binPath, ftpluginPath;

// search in vim's standard 'pack' directories
PathName("~/.vim/pack/*/*/".standardizePath).folders.do{ |folder|
if(folder.fullPath.contains("scvim")) {
basePath = folder.fullPath;
};
};
// see if this file in the 'scvim' directory, prefer that
basePath = PathName(this.class.filenameSymbol.asString.dirname) +/+ "..";

// search two folders deep below ~/.vim for a folder named "*scvim*"
if(basePath.isNil) {
PathName("~/.vim".standardizePath).folders.do{ |folder|
binPath = basePath +/+ PathName("bin/");
ftpluginPath = basePath +/+ PathName("ftplugin/");

if(File.exists(binPath.fullPath) && File.exists(ftpluginPath.fullPath)) {
basePath = basePath.fullPath;
} {
basePath = nil;
// search in vim's standard 'pack' directories
PathName("~/.vim/pack/*/*/".standardizePath).folders.do{ |folder|
if(folder.fullPath.contains("scvim")) {
basePath = folder.fullPath;
} {
folder.folders.do{ |subfolder|
if(subfolder.fullPath.contains("scvim")) {
basePath = subfolder.fullPath;
};
};

// search two folders deep below ~/.vim for a folder named "*scvim*"
if(basePath.isNil) {
PathName("~/.vim".standardizePath).folders.do{ |folder|
if(folder.fullPath.contains("scvim")) {
basePath = folder.fullPath;
} {
folder.folders.do{ |subfolder|
if(subfolder.fullPath.contains("scvim")) {
basePath = subfolder.fullPath;
}
}
}
};
};
};
};

if(basePath.isNil) {
("\nSCVim could not be initialized.\n"
++ "Consult the README to see how to install scvim.\n").error
++ "Consult the README to see how to install scvim.\n").error
} {
//collect all class names as strings in a Array
classList = Object.allSubclasses.collect{ arg i; var name;
Expand All @@ -79,7 +90,7 @@ SCVim {
file = File((basePath ++ "/syntax/supercollider_objects.vim").standardizePath,"w");
file.write(hugeString);
file.close;
}
};
};
}

Expand Down