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

Add Disc Support #3

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Add Disc Support #3

wants to merge 7 commits into from

Conversation

VTXG
Copy link

@VTXG VTXG commented Jan 17, 2025

Users can now input a path to output disc files of modules too.
This also makes a slight change to how the unibuild flag is checked, which prevents some issues.

@SuperHackio
Copy link
Member

This also makes a slight change to how the unibuild flag is checked, which prevents some issues.

Sorry, what issues? I was unable to figure out what the problem is

@VTXG
Copy link
Author

VTXG commented Jan 18, 2025

This was what I was refering to, it's not an issue, I just misphrased it, sorry about that.
image

@SuperHackio
Copy link
Member

Is the Disc Path supposed to be an optional argument? It looks that way, but the readme has it in the mandatory <> signs.

@VTXG
Copy link
Author

VTXG commented Jan 18, 2025

It is an optional argument yeah, should I replace it with [ ]?

@SuperHackio
Copy link
Member

If it's optional, then a system to have unordered arguments needs to be added as well, as -u [disc path] and [disc path] -u should both be valid because they are optional

@VTXG
Copy link
Author

VTXG commented Jan 18, 2025

Hmmm yeah, I'll get to implementing that.

@VTXG
Copy link
Author

VTXG commented Jan 18, 2025

Done! I've also made the optional argument parser a function in case anybody wants to add more optional arguments in the future.

if (args.Length > 4 && args[4] != "-u") { // Make sure the argument in the position of Path_To_Disc_Output_Folder isn't the unibuild flag
Console.WriteLine();
Console.WriteLine("Copying disc...");
// if (args.Length > 4 && args[4] != "-u") { // Make sure the argument in the position of Path_To_Disc_Output_Folder isn't the unibuild flag
Copy link
Author

Choose a reason for hiding this comment

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

Oops, left that in accidentally, I'll fix it rn

Copy link
Member

@SuperHackio SuperHackio left a comment

Choose a reason for hiding this comment

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

First time ever writing a review lol.

SyatiModuleBuildTool/Program.cs Outdated Show resolved Hide resolved
SyatiModuleBuildTool/Program.cs Outdated Show resolved Hide resolved
SyatiModuleBuildTool/Program.cs Outdated Show resolved Hide resolved
SyatiModuleBuildTool/DiscUtility.cs Outdated Show resolved Hide resolved
SyatiModuleBuildTool/DiscUtility.cs Outdated Show resolved Hide resolved
SyatiModuleBuildTool/DiscUtility.cs Outdated Show resolved Hide resolved
SyatiModuleBuildTool/DiscUtility.cs Outdated Show resolved Hide resolved
@VTXG
Copy link
Author

VTXG commented Jan 19, 2025

Done!

@SuperHackio
Copy link
Member

Hey actually, what happens if two modules provide the same file? There should probably be a warning about that...

@VTXG
Copy link
Author

VTXG commented Jan 19, 2025

Currently the last file to be copied is the one that stays, but now that you mention it...
I'll add a warning real quick.

@SuperHackio
Copy link
Member

SuperHackio commented Jan 19, 2025

I would actually prefer that it be handled properly instead of just being a warning, if possible.
Granted, I don't know what goes into "handling it properly"

@VTXG
Copy link
Author

VTXG commented Jan 19, 2025

Yea, also not sure how to handle it.

@VTXG
Copy link
Author

VTXG commented Jan 19, 2025

Added a simple warning when a file is overwritten.

var targetPath = Path.Combine(output, relativePath);

try {
if (Path.Exists(targetPath))
Console.WriteLine($" - File will replace {targetPath}");
Copy link
Member

Choose a reason for hiding this comment

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

I do not understand this error. what file will replace targetPath?

var targetDirectory = Path.GetDirectoryName(targetPath);
if (targetDirectory is not null)
Directory.CreateDirectory(targetDirectory);

File.Copy(sourcePath, targetPath, true);
}
catch (Exception e) {
Console.WriteLine($"Error while copying \"{sourceDiscFolder}\": {e.Message}");
Console.WriteLine($"Error while copying {discFolder}: {e.Message}");
Copy link
Member

Choose a reason for hiding this comment

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

Restore the quotation marks please

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.

2 participants