diff --git a/CHANGELOG.md b/CHANGELOG.md index a1840c0a..d328ba56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,7 +15,7 @@ * Added merge_map and migrated to 2.0.0 (6/6 tests passed) * Added mock_request and migrated to 2.0.0 (5/5 tests) * Migrated angel_framework to 4.0.0 (149/150 tests passed) -* Migrated angel_auth to 4.0.0 (27/30 tests passed) +* Migrated angel_auth to 4.0.0 (29/30 tests passed) * Migrated angel_configuration to 4.0.0 (6/8 testspassed) * Migrated angel_validate to 4.0.0 (6/7 tests passed) * Migrated json_god to 4.0.0 (13/13 tests passed) @@ -31,7 +31,7 @@ * Added html_builder and migrated to 2.0.0 (1/1 tests passed) * Migrated hot to 4.0.0 (0/0 tests passed) * Added range_header and migrated to 3.0.0 (12/12 tests passed) -* Migrated static to 4.0.0 (11/12 test passed) +* Migrated angel_static to 4.0.0 (12/12 test passed) * Created basic-sdk-2.12.x_nnbd template (1/1 test passed) <= Milestone 1 * Migrated angel_serialize to 4.0.0 (0/0 test passed) * Migrated angel_serialize_generator to 4.0.0 (33/33 tests passed) diff --git a/packages/static/CHANGELOG.md b/packages/static/CHANGELOG.md index c8a4c2b0..9f3a6d50 100644 --- a/packages/static/CHANGELOG.md +++ b/packages/static/CHANGELOG.md @@ -2,9 +2,11 @@ ## 4.0.1 -* Fixed `push_state_test` unit test failure on Windows * Fixed NNBD related issues -* Added logging to `VirtualDirectory` and `CachingVirtualDirectory` to log exception +* Added logging to `VirtualDirectory` and `CachingVirtualDirectory` to capture exception +* Auto detect and change file separator when POSIX file system is on Windows and vice versa +* Fixed `push_state_test` unit test failure on Windows +* 12/12 unit tests passed ## 4.0.0 diff --git a/packages/static/lib/src/virtual_directory.dart b/packages/static/lib/src/virtual_directory.dart index f958ba6a..4c779a6a 100644 --- a/packages/static/lib/src/virtual_directory.dart +++ b/packages/static/lib/src/virtual_directory.dart @@ -129,10 +129,15 @@ class VirtualDirectory { return true; } - // Replace the separator when running on Windows with file system - // detected as Linux + // Update to the correct file separator based on file system if (absolute.contains('\\') && fileSystem.path.separator == '/') { absolute = absolute.replaceAll('\\', '/'); + _log.warning( + 'Incompatible file system type is used. Changed file separator from "\\" to "/".'); + } else if (absolute.contains('/') && fileSystem.path.separator == '\\') { + absolute = absolute.replaceAll('/', '\\'); + _log.warning( + 'Incompatible file system type. Changed file separator from "/" to "\\".'); } var stat = await fileSystem.stat(absolute); diff --git a/packages/static/test/push_state_test.dart b/packages/static/test/push_state_test.dart index 349620f4..e32115bb 100644 --- a/packages/static/test/push_state_test.dart +++ b/packages/static/test/push_state_test.dart @@ -11,8 +11,12 @@ void main() { late TestClient client; setUp(() async { + // For teting on Linux/MacOS fileSystem = MemoryFileSystem(); + // For testing on Windows + //fileSystem = MemoryFileSystem(style: FileSystemStyle.windows); + var webDir = fileSystem.directory('web'); await webDir.create(recursive: true);