Skip to content

Commit

Permalink
feat: Make merge_javascript relative to file
Browse files Browse the repository at this point in the history
This patch makes the merge_javascript script relative to the location of
the file and not the location that the script was called from. Ensures
the script will always run as intended regardless of where you ran the
script from.
  • Loading branch information
Jacobomara901 committed Jun 5, 2024
1 parent 0765e56 commit 93944f9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions code/web/interface/themes/responsive/js/merge_javascript.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<?php
header('Content-type: text/plain');
date_default_timezone_set('America/Denver');
$mergeListFile = fopen("./javascript_files.txt", 'r');
$mergedFile = fopen("./aspen.js", 'w');
$mergeListFile = fopen(__DIR__ . "/javascript_files.txt", 'r');
$mergedFile = fopen(__DIR__ . "/aspen.js", 'w');
while (($fileToMerge = fgets($mergeListFile)) !== false){
$fileToMerge = trim($fileToMerge);
if (strpos($fileToMerge, '#') !== 0){
if (file_exists($fileToMerge)){
fwrite($mergedFile, file_get_contents($fileToMerge, true));
if (file_exists(__DIR__ . '/' . $fileToMerge)){
fwrite($mergedFile, file_get_contents(__DIR__ . '/' . $fileToMerge, true));
fwrite($mergedFile, "\r\n");
}else{
echo("$fileToMerge does not exist\r\n");
echo("$fileToMerge does not exist\r\n");
}
}
}
Expand Down

0 comments on commit 93944f9

Please sign in to comment.