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 option --out-dir to packge vector_graphics_compiler #215

Merged
merged 4 commits into from
Sep 21, 2023
Merged
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ final ArgParser argParser = ArgParser()
'Only includes files that end with .svg. '
'Cannot be combined with --input or --output.',
)
..addOption(
'out-dir',
help: 'The output directory path '
'use it with --input-dir to specific the output dirictory',
)
..addOption(
'input',
abbr: 'i',
Expand Down Expand Up @@ -144,7 +149,23 @@ Future<void> main(List<String> args) async {
if (!file.path.endsWith('.svg')) {
continue;
}
final String outputPath = '${file.path}.vec';

String outputPath = '${file.path}.vec';

// to specfic the output directory when parse multi svg
if (results.wasParsed('out-dir')) {
final Directory outDir = Directory(results['out-dir'] as String);
//to add the output dirctory if it exist
if (!outDir.existsSync()) {
outDir.createSync();
}
if (Platform.isWindows) {
outputPath = '${outDir.path}\\${file.path.split("\\").last}.vec';
} else {
outputPath = '${outDir.path}/${file.path.split("/").last}.vec';
Copy link
Owner

Choose a reason for hiding this comment

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

Use package:path's join method instead.

}
}

pairs.add(Pair(file.path, outputPath));
}
} else {
Expand Down