Skip to content

Commit 1dc8ca1

Browse files
committed
give warning if file already exists
1 parent 0b4f048 commit 1dc8ca1

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

Assets/FbxExporters/Editor/ExportModelEditorWindow.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,18 @@ void OnGUI ()
116116
var filePath = ExportSettings.GetAbsoluteSavePath();
117117
filePath = System.IO.Path.Combine (filePath, m_exportFileName);
118118

119-
//TODO: check if file already exists, give a warning if it does
119+
// check if file already exists, give a warning if it does
120+
if (System.IO.File.Exists (filePath)) {
121+
bool overwrite = UnityEditor.EditorUtility.DisplayDialog (
122+
string.Format("{0} Warning", ModelExporter.PACKAGE_UI_NAME),
123+
string.Format("File {0} already exists.", filePath),
124+
"Overwrite", "Cancel");
125+
if (!overwrite) {
126+
this.Close ();
127+
return;
128+
}
129+
}
130+
120131
if (ModelExporter.ExportObjects (filePath, exportType: m_animExportType, lodExportType: ExportSettings.instance.lodExportType) != null) {
121132
// refresh the asset database so that the file appears in the
122133
// asset folder view.

0 commit comments

Comments
 (0)