Let's try being conservative

This commit is contained in:
John Doty 2022-06-13 21:27:33 -07:00
parent 480f261570
commit b5b441ae53

View file

@ -11,6 +11,7 @@ ignore = {
"vscode", "vscode",
"terminal", "terminal",
".DS_Store", ".DS_Store",
".config",
} }
@ -35,15 +36,29 @@ def link_helper(source, dst):
print("Linking: {} -> {}".format(source, dst)) print("Linking: {} -> {}".format(source, dst))
os.symlink(source, dst) os.symlink(source, dst)
root_directory = os.getcwd()
# Set up the vast majority of the files here: most things in *this* directory # Set up the vast majority of the files here: most things in *this* directory
# go into the home directory directly. (Directly directory?) # go into the home directory directly. (Directly directory?)
home = os.path.expanduser("~") home = os.path.expanduser("~")
source_files = [file for file in os.listdir(os.getcwd()) if file not in ignore] source_files = [file for file in os.listdir(root_directory) if file not in ignore]
for source in source_files: for source in source_files:
source = os.path.abspath(source) source = os.path.abspath(source)
dst = os.path.join(home, os.path.split(source)[1]) dst = os.path.join(home, os.path.split(source)[1])
link_helper(source, dst) link_helper(source, dst)
# Mess with .config.
#
# .config is special; sometimes we arrive on a machine with a .config already
# present, and want to maintain it. Sometimes we just don't want to track a
# subdirectory. You know.
home_config = os.path.join(os.path.expanduser("~"), ".config")
for source in os.listdir(os.path.join(root_directory, ".config")):
source = os.path.abspath(source)
dst = os.path.join(home_config, os.path.split(source)[1])
link_helper(source, dst)
# VS Code goes somewhere else, not in the home directory. It depends on the # VS Code goes somewhere else, not in the home directory. It depends on the
# platform and it also has this VS Code @ FB thing, yikes. So here are the # platform and it also has this VS Code @ FB thing, yikes. So here are the
# roots, in the order that we're going to prefer them. # roots, in the order that we're going to prefer them.