# app（アプリケーション）

以下は`app`の一般的な属性の例です：

```javascript
console.log(eagle.app.version);				// Eagle のバージョン
console.log(eagle.app.build);				// Eagle のビルド番号
console.log(eagle.app.locale);				// アプリケーションの言語設定, en/zh_CN/zh_TW/ja_JP
console.log(eagle.app.arch);				// x86 | x64
console.log(eagle.app.platform);			// darwin | win32
console.log(eagle.app.isWindows);			// true | false, 操作システムが Windows かどうか
console.log(eagle.app.isMac);				// true | false, 操作システムが Mac かどうか
console.log(eagle.app.runningUnderARM64Translation);	// Rosetta 変換モードで実行されているかどうか
```

## メソッド <a href="#z1a5y" id="z1a5y"></a>

## isDarkColors() <a href="#a6hjz" id="a6hjz"></a>

現在のシステムがダーク（Dark）モードであるかどうかを確認します。

* `boolean` を返します - 現在のシステムがダークモードであるかどうか。

```javascript
eagle.app.isDarkColors();		// true | false
```

## getPath(name) <a href="#b8lgu" id="b8lgu"></a>

以下のパスを名前でリクエストします。

* `name` string - 以下のパスを名前でリクエストします。
  * `home` - ユーザーのホームフォルダ（メインディレクトリ）
  * `appData` - 各ユーザーのアプリケーションデータディレクトリ、デフォルトでは：
  * `userData` - アプリケーションの設定ファイルを保存するフォルダで、デフォルトは appData フォルダにアプリケーション名が追加されます。習慣的にユーザーが保存するデータファイルはこのディレクトリに書かれるべきですが、大きなファイルをここに書くことはお勧めしません。なぜなら、いくつかの環境ではこのディレクトリがクラウドストレージにバックアップされるためです。
  * `temp` - 一時ファイルフォルダ
  * `exe` - 現在の実行ファイル
  * `desktop` - 現在のユーザーのデスクトップフォルダ
  * `documents` - ユーザーのドキュメントディレクトリへのパス
  * `downloads` - ユーザーのダウンロードディレクトリへのパス
  * `music` - ユーザーの音楽ディレクトリへのパス
  * `pictures` - ユーザーの画像ディレクトリへのパス
  * `videos` - ユーザーのビデオディレクトリへのパス
  * `recent` - ユーザーの最近使用したファイルのディレクトリ (Windows のみ)。
* `Promise<path: string>` を返します - `path` はクエリパスの結果です。

```javascript
await eagle.app.getPath('appData');    // 'C:\Users\User\AppData\Roaming'
await eagle.app.getPath('pictures');    // 'C:\Users\User\Pictures'
await eagle.app.getPath('desktop');    // 'C:\Users\User\Desktop'
```

{% hint style="info" %}
備考：この機能は、Electron APIの[app.getPath](https://www.electronjs.org/zh/docs/latest/api/app#appgetapppath)と類似しています。
{% endhint %}

## getFileIcon(path\[, options]) <a href="#ndrop" id="ndrop"></a>

指定されたパスのファイル関連のアイコンを取得します。

* `path` string - アイコンを取得したいファイルのパス
* `options` Object（オプション）
  * `size` string
  * `small` - 16x16
  * `normal` - 32x32
  * `large` - `Windows`は32x32、`macOS`はサポートされていません。
* 戻り値 `Promise<img: NativeImage>`
  * `img` [NativeImage](https://www.electronjs.org/zh/docs/latest/api/native-image) - NativeImageタイプのアプリアイコン。

```javascript
let img = await eagle.app.getFileIcon('path_to_file', { size: 'small' });

// 画像情報を取得する
let base64 = img.toDataURL();
let size = img.getSize();    // {'width': 16, height: 16}

// コンピュータに保存する
let buffer = img.toPNG();
require('fs').writeFileSync('output_path/example.png', buffer);
```

{% hint style="info" %}
備考：この機能は、Electron APIの[app.getAppIcon](https://www.electronjs.org/zh/docs/latest/api/app#appgetfileiconpath-options)と類似しています。
{% endhint %}

## createThumbnailFromPath(path, maxSize) <a href="#psczp" id="psczp"></a>

指定されたパスのファイル関連のアイコンを取得します。

* `path` string - サムネイル画像を取得したいファイルのパス
* `maxSize` Size - サムネイル画像の最大幅および高さ（正数）を返します。Windowsプラットフォームでは、maxSize.heightが無視され、maxSize.widthに応じて高さが縮小されます。
* 戻り値 `Promise<img: NativeImage>`
  * `img` [NativeImage](https://www.electronjs.org/zh/docs/latest/api/native-image) - ファイルのサムネイルプレビュー画像。

```javascript
let img = await eagle.app.createThumbnailFromPath('path_to_file', { 
    height: 200, 
    width: 200 
});

// 画像情報を取得する
let base64 = img.toDataURL();
let size = img.getSize();    // {'width': 200, height: 150}

// コンピュータに保存する
let buffer = img.toPNG();
require('fs').writeFileSync('output_path/example.png', buffer);
```

{% hint style="info" %}
備考：この機能は、Electron APIの[nativeImage.createThumbnailFromPath(path, maxSize)](https://www.electronjs.org/zh/docs/latest/api/native-image#nativeimagecreatethumbnailfrompathpath-maxsize-macos-windows)と類似しています。
{% endhint %}

## show() <a href="#show" id="show"></a>

Eagle メインアプリケーションウィンドウを前面に表示します。

* `Promise<boolean>` を返します - 操作が成功したかどうか。

```javascript
await eagle.app.show();
```

{% hint style="info" %}
注意：この機能には Eagle 4.0 build18 以降が必要です。
{% endhint %}

## 属性 <a href="#adtwq" id="adtwq"></a>

## version <a href="#f95hw" id="f95hw"></a>

`string`属性、現在のEagleアプリケーションのバージョンを取得する。

## build <a href="#gwrv2" id="gwrv2"></a>

`number`属性、現在のEagleアプリケーションのBuild Numberを取得する。

## locale <a href="#dd0fm" id="dd0fm"></a>

`string`属性、現在のEagleアプリケーションのインターフェイス言語を取得する。

* `en` - 英語
* `zh_CN` - 簡体字中国語
* `zh_TW` - 繁体字中国語
* `ja_JP` - 日本語
* `ko_KR` - 韓国語
* `es_ES` - スペイン語
* `de_DE` - ドイツ語
* `ru_RU` - ロシア語

## arch <a href="#hqmzh" id="hqmzh"></a>

`string`属性、オペレーティングシステムのCPUアーキテクチャを返します。

* `x64`
* `arm64`
* `x86`

## platform <a href="#z5qbr" id="z5qbr"></a>

`string`属性、オペレーティングシステムプラットフォームを識別する文字列を返します。

* `darwin` - macOSオペレーティングシステム
* `win32` - Windowsオペレーティングシステム

## env <a href="#bdd4y" id="bdd4y"></a>

`Object`属性、環境変数のオブジェクトを返します。

```javascript
console.log(eagle.app.env);

{
  APPDATA: "C:\\Users\\User\\AppData\\Roaming",
  HOMEDRIVE: "C:",
  HOMEPATH: "\\Users\\User",
  LANG: "zh_TW.UTF-8",
  TEMP: "C:\\Users\\User\\AppData\\Local\\Temp"
}
```

```javascript
console.log(eagle.app.env['TEMP']);

"C:\\Users\\User\\AppData\\Local\\Temp"
```

## execPath <a href="#uvg0k" id="uvg0k"></a>

`string`属性、現在のアプリケーションの実行パス。

```javascript
console.log(eagle.app.execPath);

"C:\\Program Files\\Eagle\\Eagle.exe"
```

## pid <a href="#cldbp" id="cldbp"></a>

`number`属性、現在のプラグインプロセスID。

## isWindows <a href="#u8kad" id="u8kad"></a>

`boolean`属性、現在のWindowオペレーティングシステムであるかどうか。

## isMac <a href="#qw2s4" id="qw2s4"></a>

`boolean`属性、現在のMacオペレーティングシステムであるかどうか。

## runningUnderARM64Translation <a href="#kbkmv" id="kbkmv"></a>

`boolean`属性、trueの場合、現在のアプリケーションがARM64ランタイム環境（例えばmacOS [Rosetta Translator Environment](https://en.wikipedia.org/wiki/Rosetta_\(software\)) や Windows [WOW](https://en.wikipedia.org/wiki/Windows_on_Windows) を使用しています。

{% hint style="info" %}
ヒント：Electron APIの[app.runningUnderARM64Translation](https://www.electronjs.org/zh/docs/latest/api/app#apprunningunderarm64translation-%E5%8F%AA%E8%AF%BB-macos-windows) と同様の機能です。このプロパティは、ユーザーが誤って変換環境の下でx64バージョンを実行している時に、アプリケーションのarm64バージョンのダウンロードを促すために使用できます。
{% endhint %}

## theme <a href="#cztqx" id="cztqx"></a>

`string`属性、現在のテーマカラーの名前です。例：`LIGHT`、`LIGHTGRAY`、`GRAY`、`DARK`、`BLUE`、`PURPLE`。

## userDataPath <a href="#ud9km" id="ud9km"></a>

`string`属性、現在のユーザーデータディレクトリのパス。

```javascript
console.log(eagle.app.userDataPath);

"C:\\Users\\User\\AppData\\Roaming\\Eagle"
```

{% hint style="info" %}
注意：この機能にはEagle 4.0 build12以降が必要です。
{% endhint %}

### &#x20;<a href="#nptwx" id="nptwx"></a>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developer.eagle.cool/plugin-api/ja-jp/api/app.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
