mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2026-10-25 15:05:25 +00:00
Ensure LF line endings
Fix broken C projects on Windows. Ensure C build tools that require LF line endings always get them, regardless of checked in profile file line endings and the developer's local git config.
This commit is contained in:
1 parent
b7cea553cd
commit
3efbccde92
1 file changed
+10
-1
+10
-1
@@ -49,6 +49,14 @@ export interface BuildStep extends WorkerBuildStep {
|
||||
|
||||
///
|
||||
|
||||
export function fixLineEndings(data: any): any {
|
||||
if (typeof data === 'string') {
|
||||
// C build tools require LF line endings.
|
||||
return data.replace(/\r\n/g, '\n');
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
export class FileWorkingStore implements WorkingStore {
|
||||
workfs: { [path: string]: FileEntry } = {};
|
||||
workerseq: number = 0;
|
||||
@@ -89,7 +97,7 @@ export class FileWorkingStore implements WorkingStore {
|
||||
let data = this.getFileData(path);
|
||||
if (data != null && typeof data !== 'string')
|
||||
throw new Error(`${path}: expected string`)
|
||||
return data as string; // TODO
|
||||
return fixLineEndings(data) as string; // TODO
|
||||
}
|
||||
getFileEntry(path: string): FileEntry {
|
||||
return this.workfs[path];
|
||||
@@ -256,6 +264,7 @@ export function populateEntry(fs, path: string, entry: FileEntry, options: Build
|
||||
if (options && options.processFn) {
|
||||
data = options.processFn(path, data);
|
||||
}
|
||||
data = fixLineEndings(data);
|
||||
// create subfolders
|
||||
var toks = path.split('/');
|
||||
if (toks.length > 1) {
|
||||
|
||||
Reference in new issue
Block a user