Files
sdk/runtime/bin/uri.h
T
Daco Harkes 592e5c144a [native assets] Support PATHEXT invocations with appended snapshot
This CL introduces an `IsolateData::asset_base_path` which contains
the fully resolved base path used for assets which are loaded with a
relative path. (Resolving both PATHEXT and symlinks.)

The asset base path is now only resolved once, instead of on every
relative asset load.

The asset base path is now eagerly resolved.
To prevent existing error messages for files not existing changing in
`dartdev` and `Isolate.spawnUri`, files not existing errors are
ignored.
To prevent `tests/standalone/io/named_pipe_script_test.dart` from
failing, failing to canonicalize a file path is treated as no asset
base path rather than reporting a failure.

TEST=pkg/dartdev/test/native_assets/*.dart

Bug: https://github.com/dart-lang/sdk/issues/60946
Change-Id: I79a9144d220dfb3e54311725d41f8f91c88db3a1
Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-arm64-try,pkg-linux-release-try,pkg-mac-release-try,pkg-mac-release-arm64-try,pkg-win-release-arm64-try,pkg-win-release-try,vm-aot-dyn-linux-debug-x64-try,vm-aot-android-release-arm64c-try,vm-aot-linux-debug-x64-try,vm-aot-mac-debug-arm64-try,vm-aot-win-debug-arm64-try,vm-aot-optimization-level-linux-release-x64-try,vm-aot-obfuscate-linux-release-x64-try,vm-msan-linux-release-x64-try,vm-asan-linux-release-x64-try,vm-linux-release-x64-try,vm-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/435421
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2025-06-26 07:47:32 -07:00

44 lines
1.1 KiB
C++

// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
#ifndef RUNTIME_BIN_URI_H_
#define RUNTIME_BIN_URI_H_
#include <memory>
#include "platform/utils.h"
namespace dart {
class ParsedUri {
public:
CStringUniquePtr scheme;
CStringUniquePtr userinfo;
CStringUniquePtr host;
CStringUniquePtr port;
CStringUniquePtr path;
CStringUniquePtr query;
CStringUniquePtr fragment;
};
// Parses a uri into its parts.
//
// Returns nullptr if the parse fails.
std::unique_ptr<ParsedUri> ParseUri(const char* uri);
// Resolves some reference uri with respect to a base uri.
//
// Returns nullptr if the resolve fails.
CStringUniquePtr ResolveUri(const char* ref_uri, const char* base_uri);
// Resolves a path with respect to a base path.
//
// Path must contain only forward slashes.
//
// Returns nullptr if the resolve fails.
CStringUniquePtr ResolvePath(const char* ref_path, const char* base_path);
} // namespace dart
#endif // RUNTIME_BIN_URI_H_