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
fae31eec
Unverified
Commit
fae31eec
authored
Jun 17, 2022
by
Jesús S Guerrero
Committed by
GitHub
Jun 17, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] temporary directory (#105815)
parent
b1b1ee9c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
1 deletion
+36
-1
file_system.dart
packages/flutter_tools/lib/src/base/file_system.dart
+11
-1
file_system_test.dart
...utter_tools/test/general.shard/base/file_system_test.dart
+25
-0
No files found.
packages/flutter_tools/lib/src/base/file_system.dart
View file @
fae31eec
...
...
@@ -6,6 +6,7 @@ import 'package:file/file.dart';
import
'package:file/local.dart'
as
local_fs
;
import
'package:meta/meta.dart'
;
import
'common.dart'
;
import
'io.dart'
;
import
'platform.dart'
;
import
'process.dart'
;
...
...
@@ -218,7 +219,12 @@ class LocalFileSystem extends local_fs.LocalFileSystem {
@override
Directory
get
systemTempDirectory
{
if
(
_systemTemp
==
null
)
{
_systemTemp
=
super
.
systemTempDirectory
.
createTempSync
(
'flutter_tools.'
)
if
(!
superSystemTempDirectory
.
existsSync
())
{
throwToolExit
(
'Your system temp directory (
${superSystemTempDirectory.path}
) does not exist. '
'Did you set an invalid override in your environment? See issue https://github.com/flutter/flutter/issues/74042 for more context.'
);
}
_systemTemp
=
superSystemTempDirectory
.
createTempSync
(
'flutter_tools.'
)
..
createSync
(
recursive:
true
);
// Make sure that the temporary directory is cleaned up if the tool is
// killed by a signal.
...
...
@@ -239,4 +245,8 @@ class LocalFileSystem extends local_fs.LocalFileSystem {
}
return
_systemTemp
!;
}
// This only exist because the memory file system does not support a systemTemp that does not exists #74042
@visibleForTesting
Directory
get
superSystemTempDirectory
=>
super
.
systemTempDirectory
;
}
packages/flutter_tools/test/general.shard/base/file_system_test.dart
View file @
fae31eec
...
...
@@ -7,6 +7,7 @@ import 'dart:io' as io;
import
'package:file/memory.dart'
;
import
'package:file_testing/file_testing.dart'
;
import
'package:flutter_tools/src/base/common.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/io.dart'
;
import
'package:flutter_tools/src/base/platform.dart'
;
...
...
@@ -15,6 +16,13 @@ import 'package:test/fake.dart';
import
'../../src/common.dart'
;
class
LocalFileSystemFake
extends
LocalFileSystem
{
LocalFileSystemFake
.
test
({
required
super
.
signals
})
:
super
.
test
();
@override
Directory
get
superSystemTempDirectory
=>
directory
(
'/does_not_exist'
);
}
void
main
(
)
{
group
(
'fsUtils'
,
()
{
late
MemoryFileSystem
fs
;
...
...
@@ -174,6 +182,23 @@ void main() {
expect
(
temp
.
existsSync
(),
isFalse
);
});
testWithoutContext
(
'throwToolExit when temp not found'
,
()
async
{
final
Signals
signals
=
Signals
.
test
();
final
LocalFileSystemFake
localFileSystem
=
LocalFileSystemFake
.
test
(
signals:
signals
,
);
try
{
localFileSystem
.
systemTempDirectory
;
fail
(
'expected tool exit'
);
}
on
ToolExit
catch
(
e
)
{
expect
(
e
.
message
,
'Your system temp directory (/does_not_exist) does not exist. '
'Did you set an invalid override in your environment? '
'See issue https://github.com/flutter/flutter/issues/74042 for more context.'
);
}
});
});
}
...
...
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