Find an Asset by Name and get it's Path?

I have an editor script that finds the Prefab based on the name of the item selected and replaces it. I’m using it to fix broken Prefab connections in my project. It works great but I’m assuming that the Prefab is a Platform and I’d like to make the code more general.

@MenuItem ("Tools/Replace with Prefab %r")
static function Revert() {
	var transforms = Selection.transforms;
	for (var i : int = 0; i < transforms.Length; i++) {
		var localPath : String = "Assets/Prefabs/Platforms/" + transforms*.gameObject.name + ".prefab";*
  •  var newObject : GameObject = EditorUtility.InstantiatePrefab(AssetDatabase.LoadAssetAtPath(localPath, Object)) as GameObject;*
    

_ newObject.transform.position = transforms*.position;_
_ newObject.transform.localRotation = transforms.localRotation;
newObject.transform.localScale = transforms.localScale;
DestroyImmediate(transforms.gameObject);
}
}*_

I think what you may want is GetAssetPath. Name says it all I think!

Klep