1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-04-07 00:15:52 +02:00

Move imported files into structured folder for easier handling & tweak syntax

This commit is contained in:
chylex 2018-07-04 06:53:31 +02:00
parent 414f3a1f9d
commit 9e5f676e23
4 changed files with 7 additions and 16 deletions

View File

@ -129,17 +129,13 @@ try{
# Imports
$delete = New-Object "System.Collections.Generic.HashSet[string]"
$importFolder = Join-Path $targetDir "scripts\imports"
foreach($path in $imports){
$text = [IO.File]::ReadAllText($path)
$text = [Regex]::Replace($text, '#import (.*)$', {
$importPath = $args[0].Groups[1].Value.Trim()
$importPath = Join-Path ([IO.Path]::GetDirectoryName($path)) $importPath
$delete.Add($importPath) | Out-Null # this is so fucking stupid
$importStr = [IO.File]::ReadAllText($importPath)
$text = [Regex]::Replace($text, '#import "(.*)"', {
$importPath = Join-Path $importFolder ($args[0].Groups[1].Value.Trim())
$importStr = [IO.File]::ReadAllText($importPath).TrimEnd()
if ($importStr[0] -eq '#'){
$importStr = $importStr.Substring($importStr.IndexOf("`n") + 1)
@ -152,12 +148,7 @@ try{
Write-Host "Resolved" $path.Substring($targetDir.Length)
}
foreach($path in $delete){
Remove-Item -Path $path
Write-Host "Deleted" $path.Substring($targetDir.Length)
}
Remove-Item -Path (Join-Path $targetDir "scripts\components")
[IO.Directory]::Delete($importFolder, $True)
# Finished

View File

@ -123,5 +123,5 @@
window.TDPF_prioritizeNewestEvent = window.TDGF_prioritizeNewestEvent;
window.TDPF_injectMustache = window.TDGF_injectMustache;
#import components/plugins.base.js
#import "scripts/plugins.base.js"
})();

View File

@ -15,4 +15,4 @@ window.TD_PLUGINS = {
}
};
#import components/plugins.base.js
#import "scripts/plugins.base.js"