Skip to content

Commit

Permalink
Improve variable for file extension
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeDoctorDE committed Sep 11, 2024
1 parent b1f95ee commit 85e62e7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions packages/lw_file_system/lib/src/api/file_system_base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ abstract class GeneralFileSystem {
Future<String> _findAvailableName(
String path, Future<bool> Function(String) hasAsset) async {
final dir = p.dirname(path);
final extension = p.extension(path);
final fileExtension = p.extension(path);
final name = p.basenameWithoutExtension(path);
var newName = name;
var i = 1;
while (await hasAsset(p.join(dir, '$newName$extension'))) {
while (await hasAsset(p.join(dir, '$newName$fileExtension'))) {
newName = '$name ($i)';
i++;
}
return p.join(dir, '$newName$extension');
return p.join(dir, '$newName$fileExtension');
}

FutureOr<String> getAbsolutePath(String relativePath) async {
Expand Down
2 changes: 1 addition & 1 deletion packages/lw_file_system/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dependencies:
git:
url: https://github.com/LinwoodDev/dart_pkgs
path: packages/lw_file_system_api
ref: d9fecade26792a9f79996d373a7ce269b2419fe1
ref: b1f95ee120ecc6d23f0e8cd930c94f52e7c759a5
# path: ^1.8.0

dev_dependencies:
Expand Down

0 comments on commit 85e62e7

Please sign in to comment.