Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for UnrealEngine's wrong file path #174

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Ryu-ga
Copy link
Contributor

@Ryu-ga Ryu-ga commented Dec 7, 2024

The file name ue4commandline.txt has been changed to uecommandline.txt in UE5.

Some applications mistakenly use both Library\Users and Documents\Users paths multiple times within a single path, more often than I expected.
To address this, I ensure that PlayTools retrieves the string from the last needle of the incorrect path.

Issue: PlayCover/PlayCover#1755

@Ryu-ga Ryu-ga marked this pull request as draft December 7, 2024 09:13
@Ryu-ga Ryu-ga force-pushed the main branch 3 times, most recently from ab77730 to 057e18f Compare December 7, 2024 10:21
@Ryu-ga Ryu-ga marked this pull request as ready for review December 7, 2024 10:22
@Ryu-ga Ryu-ga requested a review from XuYicong December 7, 2024 10:22
@Ryu-ga
Copy link
Contributor Author

Ryu-ga commented Dec 7, 2024

Have you submitted the latest code? This code writes the username to the beginning of UE_PATTERN, then //Users/ is missing

static char UE_PATTERN[1024] = "//Users/";
getlogin_r(UE_PATTERN, sizeof(UE_PATTERN) - 8);

Really, I'm a trash generator..

@viatearz
Copy link

viatearz commented Dec 7, 2024

Sorry, I can't test it, getlogin_r still returns root to me.
Have you ever print the result of getlogin_r?

@Ryu-ga
Copy link
Contributor Author

Ryu-ga commented Dec 7, 2024

Sorry, I can't test it, getlogin_r still returns root to me. Have you ever print the result of getlogin_r?

Yes I tested it in both PlayTools and pure C program.


static char const* ue_fix_filename(char const* filename) {
static char UE_PATTERN[1024] = "//Users/";
getlogin_r(UE_PATTERN + 8, sizeof(UE_PATTERN) - 8);
Copy link
Member

Choose a reason for hiding this comment

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

What does this function do in the code (seems unused)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The prefix //Users can be insufficient, so I added the username to the prefix path UE_PATTERN.

static char UE_PATTERN[1024] = "//Users/";
getlogin_r(UE_PATTERN + 8, sizeof(UE_PATTERN) - 8);

char const* p = filename;
Copy link
Member

Choose a reason for hiding this comment

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

Can you rename this variable so it is more descriptive of its purpose?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will rename the variable UE_PATTERN to USER_HOME and add a comment for it.

if (is_ue4) {
[PlayKeychain debugLogger: [NSString stringWithFormat:@"Is it UE4? : %@", @(is_ue4)]];

if (ue_status == 0) {
Copy link
Member

Choose a reason for hiding this comment

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

Will ue_status never equal 0 on initialization?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants