"editor application does not exist" how to solve that?

var sceneName = System.IO.Path.GetFileNameWithoutExtension( EditorApplication.currentScene );

it says that in that this line is incorrect that it “does not exist in current location” Help!!

EditorApplication is documented as an Editor-only class.

#pragma strict

import UnityEditor;
	
	@MenuItem ("Example/example")
	static function SaveTempScene() {
		var path : String = EditorApplication.currentScene;
		Debug.Log(path);
		var sceneName = System.IO.Path.GetFileNameWithoutExtension(path);
		Debug.Log(sceneName);
	}