mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-09 07:28:14 -07:00
fix: Sync basename parsing for different hosts (#583)
This commit is contained in:
parent
2f7328c954
commit
52c12e63b6
2 changed files with 11 additions and 2 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import 'package:fladder/models/items/item_shared_models.dart';
|
||||
import 'package:path/path.dart' as path;
|
||||
|
||||
extension StringExtensions on String {
|
||||
String capitalize() {
|
||||
|
|
@ -49,6 +50,13 @@ extension StringExtensions on String {
|
|||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// Supports both Linux and Windows server path separators as referenced in [path.separator].
|
||||
/// Instead of the [path.basename] method, which returns the last part of the path for the current client platform.
|
||||
String get universalBasename {
|
||||
final parts = split(RegExp(r'[\\/]+'));
|
||||
return parts.where((s)=>s.isNotEmpty).lastOrNull ?? '';
|
||||
}
|
||||
}
|
||||
|
||||
extension ListExtensions on List<String> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue