mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-05-25 08:34:05 +02:00
Fix broken post-build script import handling
This commit is contained in:
parent
9f5580d983
commit
a834e8b6a2
@ -68,6 +68,7 @@ let main (argv: string[]) =
|
|||||||
line.TrimStart()
|
line.TrimStart()
|
||||||
|
|
||||||
// Functions (File Management)
|
// Functions (File Management)
|
||||||
|
|
||||||
let copyFile source target =
|
let copyFile source target =
|
||||||
File.Copy(source, target, true)
|
File.Copy(source, target, true)
|
||||||
|
|
||||||
@ -94,7 +95,7 @@ let main (argv: string[]) =
|
|||||||
// Functions (File Processing)
|
// Functions (File Processing)
|
||||||
|
|
||||||
let byPattern path pattern =
|
let byPattern path pattern =
|
||||||
Directory.EnumerateFiles(path, pattern, SearchOption.AllDirectories)
|
Directory.EnumerateFiles(path, pattern, SearchOption.AllDirectories) |> Seq.filter (fun (file: string) -> not (file.Contains(importsDir)))
|
||||||
|
|
||||||
let exceptEndingWith name =
|
let exceptEndingWith name =
|
||||||
Seq.filter (fun (file: string) -> not (file.EndsWith(name)))
|
Seq.filter (fun (file: string) -> not (file.EndsWith(name)))
|
||||||
@ -121,7 +122,7 @@ let main (argv: string[]) =
|
|||||||
let includeVersion = relativePath.StartsWith(@"scripts\") && not (relativePath.StartsWith(@"scripts\imports\"))
|
let includeVersion = relativePath.StartsWith(@"scripts\") && not (relativePath.StartsWith(@"scripts\imports\"))
|
||||||
let finalLines = if includeVersion then seq { yield "#" + version; yield! lines } else lines
|
let finalLines = if includeVersion then seq { yield "#" + version; yield! lines } else lines
|
||||||
|
|
||||||
File.WriteAllLines(fullPath, finalLines |> filterNotEmpty |> Seq.toArray)
|
File.WriteAllLines(fullPath, finalLines |> Seq.toArray)
|
||||||
printfn "Processed %s" relativePath
|
printfn "Processed %s" relativePath
|
||||||
|
|
||||||
let processFiles (files: string seq) (extProcessors: IDictionary<string, (string seq -> string seq)>) =
|
let processFiles (files: string seq) (extProcessors: IDictionary<string, (string seq -> string seq)>) =
|
||||||
@ -184,6 +185,7 @@ let main (argv: string[]) =
|
|||||||
|> replaceRegex @"^(.*?)((?<=^|[;{}()])\s?//(?:\s.*|$))?$" "$1"
|
|> replaceRegex @"^(.*?)((?<=^|[;{}()])\s?//(?:\s.*|$))?$" "$1"
|
||||||
|> replaceRegex @"(?<!\w)(return|throw)(\s.*?)? if (.*?);" "if ($3)$1$2;"
|
|> replaceRegex @"(?<!\w)(return|throw)(\s.*?)? if (.*?);" "if ($3)$1$2;"
|
||||||
)
|
)
|
||||||
|
|> filterNotEmpty
|
||||||
);
|
);
|
||||||
|
|
||||||
".css", (fun (lines: string seq) ->
|
".css", (fun (lines: string seq) ->
|
||||||
@ -204,6 +206,7 @@ let main (argv: string[]) =
|
|||||||
".html", (fun (lines: string seq) ->
|
".html", (fun (lines: string seq) ->
|
||||||
lines
|
lines
|
||||||
|> Seq.map trimStart
|
|> Seq.map trimStart
|
||||||
|
|> filterNotEmpty
|
||||||
);
|
);
|
||||||
|
|
||||||
".meta", (fun (lines: string seq) ->
|
".meta", (fun (lines: string seq) ->
|
||||||
|
Loading…
Reference in New Issue
Block a user