@@ -6,6 +6,7 @@ import 'sentry_database_executor.dart';
6
6
import 'sentry_sqflite_transaction.dart' ;
7
7
import 'version.dart' ;
8
8
import 'utils/sentry_database_span_attributes.dart' ;
9
+ import 'package:path/path.dart' as p;
9
10
10
11
/// A [Database] wrapper that adds Sentry support.
11
12
///
@@ -56,27 +57,15 @@ class SentryDatabase extends SentryDatabaseExecutor implements Database {
56
57
this ._database, {
57
58
@internal Hub ? hub,
58
59
}) : _hub = hub ?? HubAdapter (),
59
- dbName = _basenameWithoutExtension (_database.path),
60
+ dbName = p. basenameWithoutExtension (_database.path),
60
61
super (_database,
61
- hub: hub, dbName: _basenameWithoutExtension (_database.path)) {
62
+ hub: hub, dbName: p. basenameWithoutExtension (_database.path)) {
62
63
// ignore: invalid_use_of_internal_member
63
64
final options = _hub.options;
64
65
options.sdk.addIntegration ('SentrySqfliteTracing' );
65
66
options.sdk.addPackage (packageName, sdkVersion);
66
67
}
67
68
68
- /// Gets the part of path after the last separator, and without any trailing file extension.
69
- static String _basenameWithoutExtension (String filePath) {
70
- final int lastIndex = filePath.lastIndexOf ('/' );
71
- final int dotIndex = filePath.lastIndexOf ('.' );
72
-
73
- if (dotIndex == - 1 || (lastIndex != - 1 && dotIndex < lastIndex)) {
74
- return filePath;
75
- }
76
-
77
- return filePath.substring (lastIndex + 1 , dotIndex);
78
- }
79
-
80
69
// TODO: check if perf is enabled
81
70
82
71
@override
0 commit comments