Skip to content

Commit 8fd2c9a

Browse files
Merge branch 'development' into fix/fmod-errors
2 parents 3d79e1f + 969a683 commit 8fd2c9a

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

src/unity-editor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ export class UnityEditor {
261261
}
262262

263263
const logPath: string = GetArgumentValueAsString('-logFile', command.args);
264-
logTail = TailLogFile(logPath);
264+
logTail = TailLogFile(logPath, command.projectPath);
265265
const commandStr = `\x1b[34m${this.editorPath} ${command.args.join(' ')}\x1b[0m`;
266266
this.logger.startGroup(commandStr);
267267

src/utilities.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,9 +359,10 @@ export interface LogTailResult {
359359
/**
360360
* Tails a log file using fs.watch and ReadStream for efficient reading.
361361
* @param logPath The path to the log file to tail.
362+
* @param projectPath The path to the project (used for log annotation).
362363
* @returns An object containing the tail promise and signalEnd function.
363364
*/
364-
export function TailLogFile(logPath: string): LogTailResult {
365+
export function TailLogFile(logPath: string, projectPath: string | undefined): LogTailResult {
365366
let logEnded = false;
366367
let lastSize = 0;
367368
const logPollingInterval = 250;
@@ -410,7 +411,12 @@ export function TailLogFile(logPath: string): LogTailResult {
410411
const message = utp.message;
411412
const stacktrace = utp.stacktrace ? `${utp.stacktrace}` : undefined;
412413
if (!message.startsWith(`\n::error::\u001B[31m`)) { // indicates a duplicate annotation
413-
Logger.instance.annotate(LogLevel.ERROR, stacktrace == undefined ? message : `${message}\n${stacktrace}`, file, lineNum);
414+
// only annotate if the file is within the current project
415+
if (projectPath && file && file.startsWith(projectPath)) {
416+
Logger.instance.annotate(LogLevel.ERROR, stacktrace == undefined ? message : `${message}\n${stacktrace}`, file, lineNum);
417+
} else {
418+
Logger.instance.error(stacktrace == undefined ? message : `${message}\n${stacktrace}`);
419+
}
414420
}
415421
}
416422
} catch (error) {

0 commit comments

Comments
 (0)