Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
46c99809
Unverified
Commit
46c99809
authored
Mar 23, 2021
by
Jenn Magder
Committed by
GitHub
Mar 23, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate flutter_tools file_system to null safety (#78896)
parent
2415eca4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
15 deletions
+13
-15
file_system.dart
packages/flutter_tools/lib/src/base/file_system.dart
+13
-15
No files found.
packages/flutter_tools/lib/src/base/file_system.dart
View file @
46c99809
...
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'package:file/file.dart'
;
import
'package:file/local.dart'
as
local_fs
;
import
'package:meta/meta.dart'
;
...
...
@@ -31,8 +29,8 @@ class FileNotFoundException implements IOException {
/// Various convenience file system methods.
class
FileSystemUtils
{
FileSystemUtils
({
@
required
FileSystem
fileSystem
,
@
required
Platform
platform
,
required
FileSystem
fileSystem
,
required
Platform
platform
,
})
:
_fileSystem
=
fileSystem
,
_platform
=
platform
;
...
...
@@ -86,8 +84,8 @@ class FileSystemUtils {
///
/// Returns false, if [entity] exists, but [referenceFile] does not.
bool
isOlderThanReference
({
@
required
FileSystemEntity
entity
,
@
required
File
referenceFile
,
required
FileSystemEntity
entity
,
required
File
referenceFile
,
})
{
if
(!
entity
.
existsSync
())
{
return
true
;
...
...
@@ -97,8 +95,8 @@ class FileSystemUtils {
}
/// Return the absolute path of the user's home directory.
String
get
homeDirPath
{
String
path
=
_platform
.
isWindows
String
?
get
homeDirPath
{
String
?
path
=
_platform
.
isWindows
?
_platform
.
environment
[
'USERPROFILE'
]
:
_platform
.
environment
[
'HOME'
];
if
(
path
!=
null
)
{
...
...
@@ -123,8 +121,8 @@ String getDisplayPath(String fullPath, FileSystem fileSystem) {
void
copyDirectory
(
Directory
srcDir
,
Directory
destDir
,
{
bool
Function
(
File
srcFile
,
File
destFile
)
shouldCopyFile
,
void
Function
(
File
srcFile
,
File
destFile
)
onFileCopied
,
bool
Function
(
File
srcFile
,
File
destFile
)
?
shouldCopyFile
,
void
Function
(
File
srcFile
,
File
destFile
)
?
onFileCopied
,
})
{
if
(!
srcDir
.
existsSync
())
{
throw
Exception
(
'Source directory "
${srcDir.path}
" does not exist, nothing to copy'
);
...
...
@@ -167,13 +165,13 @@ class LocalFileSystem extends local_fs.LocalFileSystem {
@visibleForTesting
LocalFileSystem
.
test
({
@
required
Signals
signals
,
required
Signals
signals
,
List
<
ProcessSignal
>
fatalSignals
=
Signals
.
defaultExitSignals
,
})
:
this
(
signals
,
fatalSignals
,
null
);
Directory
_systemTemp
;
Directory
?
_systemTemp
;
final
Map
<
ProcessSignal
,
Object
>
_signalTokens
=
<
ProcessSignal
,
Object
>{};
final
ShutdownHooks
_shutdownHooks
;
final
ShutdownHooks
?
_shutdownHooks
;
Future
<
void
>
dispose
()
async
{
_tryToDeleteTemp
();
...
...
@@ -189,7 +187,7 @@ class LocalFileSystem extends local_fs.LocalFileSystem {
void
_tryToDeleteTemp
()
{
try
{
if
(
_systemTemp
?.
existsSync
()
??
false
)
{
_systemTemp
.
deleteSync
(
recursive:
true
);
_systemTemp
?
.
deleteSync
(
recursive:
true
);
}
}
on
FileSystemException
{
// ignore.
...
...
@@ -225,6 +223,6 @@ class LocalFileSystem extends local_fs.LocalFileSystem {
_tryToDeleteTemp
,
);
}
return
_systemTemp
;
return
_systemTemp
!
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment