Skip to content

Commit

Permalink
improved handling of assets directory path
Browse files Browse the repository at this point in the history
  • Loading branch information
rutvik110 committed Sep 30, 2022
1 parent d13f237 commit db94003
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
Binary file modified .DS_Store
Binary file not shown.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 0.1.3-dev.2+4

- Improved handling of assets directory paths.
## 0.1.3-dev.1+4

- Removed hardcoded forward slash while adding assets directory paths. Resolves an issue which resulted in the path being invalid on windows.
## 0.1.3-dev.0+4

- Check added to check if fonts dir exists or not before traversing it for code generation.
Expand Down
8 changes: 6 additions & 2 deletions lib/asset_manager_cli.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void addAssetsCode(Logger logger) async {
final subdirectory = subdirectories[i];
if (subdirectory is Directory) {
if (!subdirectory.path.contains("fonts")) {
assetsString.add(" - ${subdirectory.path}/");
assetsString.add(generateAssetDirPath(subdirectory.path));

assetsString.addAll(generateDirAssetsCode(subdirectory));
}
Expand Down Expand Up @@ -129,7 +129,7 @@ List<String> generateDirAssetsCode(Directory directory) {
if (subDir is Directory) {
final subDirPath = subDir.path;
if (!subDirPath.contains('fonts')) {
assetString.add(" - $subDirPath/");
assetString.add(generateAssetDirPath(subDirPath));
}
assetString.addAll(generateDirAssetsCode(subDir));
}
Expand All @@ -141,3 +141,7 @@ List<String> generateDirAssetsCode(Directory directory) {
Future<void> updateCLI() async {
await pubUpdater.update(packageName: "asset_manager_cli");
}

String generateAssetDirPath(String path) {
return " - $path";
}
6 changes: 3 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: asset_manager_cli
description: Auto-generate the assets code and add it to your pubspec.yaml .
version: 0.1.3-dev.0+4
version: 0.1.3-dev.2+4
homepage: https://github.com/rutvik110/asset_manager_cli
funding:
- https://www.buymeacoffee.com/takrutvik
- https://www.buymeacoffee.com/takrutvik

environment:
sdk: '>=2.18.0 <3.0.0'
sdk: ">=2.18.0 <3.0.0"

dependencies:
args: ^2.3.1
Expand Down

0 comments on commit db94003

Please sign in to comment.