Skip to content

Instantly share code, notes, and snippets.

@triacontane
Created October 30, 2019 14:40
Show Gist options
  • Select an option

  • Save triacontane/c7834d2e63d3efb37bc85625faa42110 to your computer and use it in GitHub Desktop.

Select an option

Save triacontane/c7834d2e63d3efb37bc85625faa42110 to your computer and use it in GitHub Desktop.
プロジェクト内のデータファイルを削除
var filePath = 'img/pictures/00.png';
var path = require('path');
var base = path.dirname(process.mainModule.filename);
var fullPath;
if (StorageManager.canMakeWwwSaveDirectory()) {
fullPath = path.join(base, filePath);
} else {
fullPath = path.join(path.dirname(base), filePath);
}
var fs = require('fs');
if (fs.existsSync(fullPath)) fs.unlinkSync(fullPath);
@triacontane
Copy link
Author

例の場合は、「00.png」というピクチャファイルを削除します。
filePath : プロジェクトルートからの相対パスで削除したいファイルパス

@triacontane
Copy link
Author

このスクリプトはローカル実行(Game.exe)でなければ動作しません。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment