Skip to content

Commit

Permalink
CCA: Rename isExist -> exists
Browse files Browse the repository at this point in the history
The name isExist is grammatically incorrect. Change it to exists, which
is a more common name (for example, Node.js fs.exists, Python
os.path.exists, Ruby File.exists).

Bug: None
Test: cca.py tsc <board> with CL:4302331
Change-Id: Iba9e2631b44173dd08029c6a40f2ae85b594be8e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4321189
Auto-Submit: Pi-Hsun Shih <pihsun@chromium.org>
Reviewed-by: Wei Lee <wtlee@chromium.org>
Commit-Queue: Pi-Hsun Shih <pihsun@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1115562}
  • Loading branch information
peter50216 authored and Chromium LUCI CQ committed Mar 10, 2023
1 parent 5bc3a54 commit f345363
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion ash/webui/camera_app_ui/resources/js/gallerybutton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export class GalleryButton implements ResultSaver {

// Checks existence of cached cover photo.
if (this.cover !== null) {
if (await dir.isExist(this.cover.name)) {
if (await dir.exists(this.cover.name)) {
return;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export interface DirectoryAccessEntry {
/**
* Checks if file or directory with the target name exists.
*/
isExist(name: string): Promise<boolean>;
exists(name: string): Promise<boolean>;

/**
* Create the file given by its |name|. If there is already a file with same
Expand Down Expand Up @@ -196,7 +196,7 @@ export class DirectoryAccessEntryImpl implements DirectoryAccessEntry {
return new FileAccessEntry(handle, this);
}

async isExist(name: string): Promise<boolean> {
async exists(name: string): Promise<boolean> {
try {
await this.getFile(name);
return true;
Expand All @@ -216,7 +216,7 @@ export class DirectoryAccessEntryImpl implements DirectoryAccessEntry {
async createFile(name: string): Promise<FileAccessEntry> {
return createFileJobs.push(async () => {
let uniqueName = name;
for (let i = 0; await this.isExist(uniqueName);) {
for (let i = 0; await this.exists(uniqueName);) {
uniqueName = name.replace(/^(.*?)(?=\.)/, `$& (${++i})`);
}
const handle =
Expand All @@ -243,7 +243,7 @@ export class DirectoryAccessEntryImpl implements DirectoryAccessEntry {
}

async removeEntry(name: string): Promise<void> {
if (await this.isExist(name)) {
if (await this.exists(name)) {
await this.handle.removeEntry(name);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// found in the LICENSE file.

import {assert} from '../assert.js';

import {
DirectoryAccessEntry,
FileAccessEntry,
Expand Down Expand Up @@ -67,11 +68,11 @@ class LazyDirectoryEntry implements DirectoryAccessEntry {
return this.directory.getFile(name);
}

async isExist(name: string): Promise<boolean> {
async exists(name: string): Promise<boolean> {
if (this.directory === null) {
return false;
}
return this.directory.isExist(name);
return this.directory.exists(name);
}

async createFile(name: string): Promise<FileAccessEntry> {
Expand Down

0 comments on commit f345363

Please sign in to comment.