Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
dart::bin::SyncDirectoryListing Class Reference

#include <directory.h>

Inheritance diagram for dart::bin::SyncDirectoryListing:
dart::bin::DirectoryListing

Public Member Functions

 SyncDirectoryListing (Dart_Handle results, Namespace *namespc, const char *dir_name, bool recursive, bool follow_links)
 
virtual ~SyncDirectoryListing ()
 
virtual bool HandleDirectory (const char *dir_name)
 
virtual bool HandleFile (const char *file_name)
 
virtual bool HandleLink (const char *file_name)
 
virtual bool HandleError ()
 
Dart_Handle dart_error ()
 
- Public Member Functions inherited from dart::bin::DirectoryListing
 DirectoryListing (Namespace *namespc, const char *dir_name, bool recursive, bool follow_links)
 
virtual ~DirectoryListing ()
 
virtual void HandleDone ()
 
void Push (DirectoryListingEntry *directory)
 
void Pop ()
 
bool IsEmpty () const
 
void PopAll ()
 
Namespacenamespc () const
 
DirectoryListingEntrytop () const
 
bool recursive () const
 
bool follow_links () const
 
const char * CurrentPath ()
 
PathBufferpath_buffer ()
 
bool error () const
 

Detailed Description

Definition at line 203 of file directory.h.

Constructor & Destructor Documentation

◆ SyncDirectoryListing()

dart::bin::SyncDirectoryListing::SyncDirectoryListing ( Dart_Handle  results,
Namespace namespc,
const char *  dir_name,
bool  recursive,
bool  follow_links 
)
inline

Definition at line 205 of file directory.h.

211 results_(results),
212 dart_error_(Dart_Null()) {
213 add_string_ = DartUtils::NewString("add");
214 from_raw_path_string_ = DartUtils::NewString("fromRawPath");
215 directory_type_ = DartUtils::GetDartType(DartUtils::kIOLibURL, "Directory");
216 file_type_ = DartUtils::GetDartType(DartUtils::kIOLibURL, "File");
217 link_type_ = DartUtils::GetDartType(DartUtils::kIOLibURL, "Link");
218 }
static constexpr const char * kIOLibURL
Definition dartutils.h:297
static Dart_Handle NewString(const char *str)
Definition dartutils.h:214
static Dart_Handle GetDartType(const char *library_url, const char *class_name)
Definition dartutils.cc:700
Namespace * namespc() const
Definition directory.h:133
DirectoryListing(Namespace *namespc, const char *dir_name, bool recursive, bool follow_links)
Definition directory.h:93
DART_EXPORT Dart_Handle Dart_Null()

◆ ~SyncDirectoryListing()

virtual dart::bin::SyncDirectoryListing::~SyncDirectoryListing ( )
inlinevirtual

Definition at line 219 of file directory.h.

219{}

Member Function Documentation

◆ dart_error()

Dart_Handle dart::bin::SyncDirectoryListing::dart_error ( )
inline

Definition at line 225 of file directory.h.

225{ return dart_error_; }

◆ HandleDirectory()

bool dart::bin::SyncDirectoryListing::HandleDirectory ( const char *  dir_name)
virtual

Implements dart::bin::DirectoryListing.

Definition at line 427 of file directory.cc.

427 {
428 // Allocates a Uint8List for dir_name, and invokes the Directory.fromRawPath
429 // constructor. This avoids/delays interpreting the UTF-8 bytes in dir_name.
430 // Later, client code may either choose to access FileSystemEntity.path.
431 // FileSystemEntity.path will trigger UTF-8 decoding and return a path with
432 // non-UTF-8 characters replaced with U+FFFD.
433
434 size_t dir_name_length = strlen(dir_name);
435 uint8_t* buffer = nullptr;
436 Dart_Handle dir_name_dart = IOBuffer::Allocate(dir_name_length, &buffer);
437 if (Dart_IsNull(dir_name_dart)) {
438 dart_error_ = DartUtils::NewDartOSError();
439 return false;
440 }
441 memmove(buffer, dir_name, dir_name_length);
442 Dart_Handle constructor_name = from_raw_path_string_;
444 Dart_New(directory_type_, constructor_name, 1, &dir_name_dart);
445 Dart_Handle result = Dart_Invoke(results_, add_string_, 1, &dir);
446 if (Dart_IsError(result)) {
447 dart_error_ = result;
448 return false;
449 }
450 return true;
451}
static Dart_Handle NewDartOSError()
Definition dartutils.cc:706
static Dart_Handle Allocate(intptr_t size, uint8_t **buffer)
Definition io_buffer.cc:12
struct _Dart_Handle * Dart_Handle
Definition dart_api.h:258
static const uint8_t buffer[]
GAsyncResult * result
DART_EXPORT Dart_Handle Dart_Invoke(Dart_Handle target, Dart_Handle name, int number_of_arguments, Dart_Handle *arguments)
DART_EXPORT bool Dart_IsError(Dart_Handle handle)
DART_EXPORT bool Dart_IsNull(Dart_Handle object)
DART_EXPORT Dart_Handle Dart_New(Dart_Handle type, Dart_Handle constructor_name, int number_of_arguments, Dart_Handle *arguments)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace Enable an endless trace buffer The default is a ring buffer This is useful when very old events need to viewed For during application launch Memory usage will continue to grow indefinitely however Start app with an specific route defined on the framework flutter assets dir
Definition switches.h:145

◆ HandleError()

bool dart::bin::SyncDirectoryListing::HandleError ( )
virtual

Implements dart::bin::DirectoryListing.

Definition at line 503 of file directory.cc.

503 {
504 Dart_Handle dart_os_error = DartUtils::NewDartOSError();
505 Dart_Handle args[3];
506 args[0] = dart_os_error;
507 args[1] = DartUtils::NewString("Directory listing failed");
508 args[2] = DartUtils::NewString(error() ? "Invalid path" : CurrentPath());
509
510 dart_error_ = Dart_New(
511 DartUtils::GetDartType(DartUtils::kIOLibURL, "FileSystemException"),
512 DartUtils::NewString("_fromOSError"), 3, args);
513 return false;
514}
const char * CurrentPath()
Definition directory.h:141
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args

◆ HandleFile()

bool dart::bin::SyncDirectoryListing::HandleFile ( const char *  file_name)
virtual

Implements dart::bin::DirectoryListing.

Definition at line 478 of file directory.cc.

478 {
479 // Allocates a Uint8List for dir_name, and invokes the Directory.fromRawPath
480 // constructor. This avoids/delays interpreting the UTF-8 bytes in dir_name.
481 // Later, client code may either choose to access FileSystemEntity.path.
482 // FileSystemEntity.path will trigger UTF-8 decoding and return a path with
483 // non-UTF-8 characters replaced with U+FFFD.
484
485 size_t file_name_length = strlen(file_name);
486 uint8_t* buffer = nullptr;
487 Dart_Handle file_name_dart = IOBuffer::Allocate(file_name_length, &buffer);
488 if (Dart_IsNull(file_name_dart)) {
489 dart_error_ = DartUtils::NewDartOSError();
490 return false;
491 }
492 memmove(buffer, file_name, file_name_length);
493 Dart_Handle constructor_name = from_raw_path_string_;
494 Dart_Handle file = Dart_New(file_type_, constructor_name, 1, &file_name_dart);
495 Dart_Handle result = Dart_Invoke(results_, add_string_, 1, &file);
496 if (Dart_IsError(result)) {
497 dart_error_ = result;
498 return false;
499 }
500 return true;
501}

◆ HandleLink()

bool dart::bin::SyncDirectoryListing::HandleLink ( const char *  file_name)
virtual

Implements dart::bin::DirectoryListing.

Definition at line 453 of file directory.cc.

453 {
454 // Allocates a Uint8List for dir_name, and invokes the Directory.fromRawPath
455 // constructor. This avoids/delays interpreting the UTF-8 bytes in dir_name.
456 // Later, client code may either choose to access FileSystemEntity.path.
457 // FileSystemEntity.path will trigger UTF-8 decoding and return a path with
458 // non-UTF-8 characters replaced with U+FFFD.
459
460 size_t link_name_length = strlen(link_name);
461 uint8_t* buffer = nullptr;
462 Dart_Handle link_name_dart = IOBuffer::Allocate(link_name_length, &buffer);
463 if (Dart_IsNull(link_name_dart)) {
464 dart_error_ = DartUtils::NewDartOSError();
465 return false;
466 }
467 memmove(buffer, link_name, link_name_length);
468 Dart_Handle constructor_name = from_raw_path_string_;
469 Dart_Handle link = Dart_New(link_type_, constructor_name, 1, &link_name_dart);
470 Dart_Handle result = Dart_Invoke(results_, add_string_, 1, &link);
471 if (Dart_IsError(result)) {
472 dart_error_ = result;
473 return false;
474 }
475 return true;
476}
link(from_root, to_root)
Definition dart_pkg.py:44

The documentation for this class was generated from the following files: