Notifications
Clear all

[Closed] How do fight a Crazy node name?

nope… string.format is worse than mxs:


 struct NodeNameExt 
 (
 private
 	regexClass = dotnetclass "System.Text.RegularExpressions.Regex",
 	pattern = "[\[\]\\\*'?]", 
 	replacement = "\\$0",
 public
 	fn doubleEnd name end:"'" = end + name + end,
 	fn insureName name = (doubleEnd (regexClass.Replace name pattern replacement)),
 	fn executableName name = ("$" + insureName name)
 )
 

i agree. artist always finds a way to break the rule.

fun is continuing…


  global NodeNameExt
  (
  	struct NodeNameStruct
  	(
  	private
  		regexClass = dotnetclass "System.Text.RegularExpressions.Regex",
  		pattern = "[\[\]\\\*'?]", 
  		replacement = "\\$0",
  	public
  		fn doubleEnd name end:"'" = end + name + end,
  		fn insureName name = (doubleEnd (regexClass.Replace name pattern replacement)),
  		fn executableName name = ("$" + insureName name),
  		fn isLegal name = not (regexClass.IsMatch name pattern),
  		fn findIllegal nodes = 
  		(
  			for node in nodes where not isLegal node.name collect node
  		)
  	)
  	NodeNameExt = NodeNameStruct()
  	ok
  )
  
Page 2 / 2