This repository has been archived on 2026-09-07. You can view files and clone it. You cannot open issues or pull requests or push a commit.
2017-07-05 20:40:20 +01:00
|
|
|
#!/usr/bin/env php
|
|
|
|
|
<?php
|
|
|
|
|
$here = __DIR__;
|
|
|
|
|
|
|
|
|
|
array_map("unlink", glob("$here/snippets/haskell-mode/*"));
|
|
|
|
|
|
|
|
|
|
$csv = fopen("$here/samples.csv", "r");
|
|
|
|
|
$headings = fgetcsv($csv);
|
|
|
|
|
|
|
|
|
|
$projects = [];
|
|
|
|
|
|
|
|
|
|
while ($data = fgetcsv($csv)) {
|
|
|
|
|
$row = array_combine($headings, $data);
|
|
|
|
|
$projects[] = $row["Project Path"];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fclose($csv);
|
|
|
|
|
|
|
|
|
|
$projects = array_unique($projects);
|
2017-07-05 21:00:13 +01:00
|
|
|
$projects = array_map(function($p) {
|
|
|
|
|
return str_replace("~", $_SERVER["HOME"], $p);
|
|
|
|
|
}, $projects);
|
2017-07-05 20:40:20 +01:00
|
|
|
|
|
|
|
|
foreach ($projects as $project) {
|
|
|
|
|
$snippetsDir = "$project/snippets";
|
|
|
|
|
if (is_dir($snippetsDir)) {
|
|
|
|
|
$files = glob("$snippetsDir/*");
|
|
|
|
|
foreach ($files as $file) {
|
|
|
|
|
$to = "$here/snippets/haskell-mode/" . basename($file);
|
|
|
|
|
if (is_link($to)) {
|
|
|
|
|
throw new Exception("$to exists");
|
|
|
|
|
}
|
|
|
|
|
symlink($file, $to);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
2017-07-05 20:53:51 +01:00
|
|
|
printf("WARNING: Snippets path %s not found\n", $snippetsDir);
|
2017-07-05 20:40:20 +01:00
|
|
|
}
|
|
|
|
|
}
|