Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/XcodeGenCLI/Commands/GenerateCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class GenerateCommand: ProjectCommand {
do {
let projectGenerator = ProjectGenerator(project: project)

guard let userName = ProcessInfo.processInfo.environment["LOGNAME"] else {
guard let userName = ProcessInfo.processInfo.environment["USER"] else {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't my area of expertise. Would this cover all bases?

Suggested change
guard let userName = ProcessInfo.processInfo.environment["USER"] else {
let environment = ProcessInfo.processInfo.environment
guard let userName = environment["USER"] ?? environment["LOGNAME"] ?? NSUserName() else {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think USER always exists it's standart *nix variable

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw error is named GenerationError.missingUsername not GenerationError.missingLogname

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the goal of this check at all? Is it passed only for file owner for created files?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's used to generate XCUserData

throw GenerationError.missingUsername
}

Expand Down