-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[xdg_directories] Migrate to null safety #250
Closed
Closed
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
7823389
Update CI for nnbd branch (#249)
7abc119
[xdg_directories] Migrate to null safety
yash1200 e9e7977
Mockito to nnbd
yash1200 c734d91
Tests fixed
yash1200 b7d28d2
Null safety changes
yash1200 35ced39
Null safety changes
yash1200 dc06918
Updated dependency
yash1200 a1be179
Made required changes
yash1200 0279a53
tmpDir late changes
yash1200 bb2b723
version changes
yash1200 c1b4be7
version changes
yash1200 a0277df
Function name changes
yash1200 4e4f35d
Function name changes
yash1200 eee3ac8
Function name changes
yash1200 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
name: xdg_directories | ||
description: A Dart package for reading XDG directory configuration information on Linux. | ||
version: 0.1.2 | ||
version: 0.2.0-nullsafety.0 | ||
homepage: https://github.com/flutter/packages/tree/master/packages/xdg_directories | ||
|
||
environment: | ||
sdk: ">=2.3.0 <3.0.0" | ||
sdk: ">=2.12.0-0 <3.0.0" | ||
|
||
dependencies: | ||
meta: ">=1.2.2 <2.0.0" | ||
path: ">=1.6.4 <2.0.0" | ||
process: ">=3.0.12 <5.0.0" | ||
meta: ^1.3.0-nullsafety.6 | ||
path: ^1.8.0-nullsafety.3 | ||
process: ^4.0.0-nullsafety.4 | ||
|
||
dev_dependencies: | ||
mockito: ^4.1.1 | ||
test: ^1.15.3 | ||
mockito: ^5.0.0-nullsafety.1 | ||
test: ^1.16.0-nullsafety.13 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ import 'package:xdg_directories/xdg_directories.dart' as xdg; | |
|
||
void main() { | ||
final Map<String, String> fakeEnv = <String, String>{}; | ||
Directory tmpDir; | ||
late Directory tmpDir; | ||
|
||
String testPath(String subdir) => path.join(tmpDir.path, subdir); | ||
|
||
|
@@ -29,11 +29,11 @@ void main() { | |
'${testPath('usr/local/test_share')}:${testPath('usr/test_share')}'; | ||
fakeEnv['XDG_DATA_HOME'] = testPath('.local/test_share'); | ||
fakeEnv['XDG_RUNTIME_DIR'] = testPath('.local/test_runtime'); | ||
Directory(fakeEnv['XDG_CONFIG_HOME']).createSync(recursive: true); | ||
Directory(fakeEnv['XDG_CACHE_HOME']).createSync(recursive: true); | ||
Directory(fakeEnv['XDG_DATA_HOME']).createSync(recursive: true); | ||
Directory(fakeEnv['XDG_RUNTIME_DIR']).createSync(recursive: true); | ||
File(path.join(fakeEnv['XDG_CONFIG_HOME'], 'user-dirs.dirs')) | ||
Directory(fakeEnv['XDG_CONFIG_HOME']!).createSync(recursive: true); | ||
Directory(fakeEnv['XDG_CACHE_HOME']!).createSync(recursive: true); | ||
Directory(fakeEnv['XDG_DATA_HOME']!).createSync(recursive: true); | ||
Directory(fakeEnv['XDG_RUNTIME_DIR']!).createSync(recursive: true); | ||
File(path.join(fakeEnv['XDG_CONFIG_HOME']!, 'user-dirs.dirs')) | ||
.writeAsStringSync(r''' | ||
XDG_DESKTOP_DIR="$HOME/Desktop" | ||
XDG_DOCUMENTS_DIR="$HOME/Documents" | ||
|
@@ -48,9 +48,7 @@ XDG_VIDEOS_DIR="$HOME/Videos" | |
}); | ||
|
||
tearDown(() { | ||
if (tmpDir != null) { | ||
tmpDir.deleteSync(recursive: true); | ||
} | ||
tmpDir.deleteSync(recursive: true); | ||
// Stop overriding the environment accessor. | ||
xdg.xdgEnvironmentOverride = null; | ||
}); | ||
|
@@ -76,7 +74,7 @@ XDG_VIDEOS_DIR="$HOME/Videos" | |
expect(xdg.cacheHome.path, equals(testPath('.test_cache'))); | ||
expect(xdg.configHome.path, equals(testPath('.test_config'))); | ||
expect(xdg.dataHome.path, equals(testPath('.local/test_share'))); | ||
expect(xdg.runtimeDir.path, equals(testPath('.local/test_runtime'))); | ||
expect(xdg.runtimeDir!.path, equals(testPath('.local/test_runtime'))); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This |
||
|
||
expectDirList(xdg.configDirs, <String>[testPath('etc/test_xdg')]); | ||
expectDirList(xdg.dataDirs, <String>[ | ||
|
@@ -122,13 +120,13 @@ class FakeProcessManager extends Fake implements ProcessManager { | |
@override | ||
ProcessResult runSync( | ||
List<dynamic> command, { | ||
String workingDirectory, | ||
Map<String, String> environment, | ||
String? workingDirectory, | ||
Map<String, String>? environment, | ||
bool includeParentEnvironment = true, | ||
bool runInShell = false, | ||
Encoding stdoutEncoding = systemEncoding, | ||
Encoding stderrEncoding = systemEncoding, | ||
}) { | ||
return ProcessResult(0, 0, expected[command[1]].codeUnits, <int>[]); | ||
return ProcessResult(0, 0, expected[command[1]]!.codeUnits, <int>[]); | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on a bug that came in recently, we should make
getUserDirectory
returnDirectory?
, because I think we'll want to add logic to make it catch run failures (e.g., due toxdg-user-dir
not being installed) and return null, and changing the return type later would be a breaking change.