From 0e1c2cdcdd33e3158338062df84adef6d36e1e1c Mon Sep 17 00:00:00 2001 From: Stefan Sedich Date: Wed, 4 Mar 2015 07:47:52 +1000 Subject: [PATCH] Change ordering within ActorSelection to fix issue where /foo paths were not working within mono on linux. --- src/core/Akka/Actor/ActorRefFactoryShared.cs | 22 +++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/core/Akka/Actor/ActorRefFactoryShared.cs b/src/core/Akka/Actor/ActorRefFactoryShared.cs index 4c64b07a74a..c29951793dc 100644 --- a/src/core/Akka/Actor/ActorRefFactoryShared.cs +++ b/src/core/Akka/Actor/ActorRefFactoryShared.cs @@ -35,28 +35,30 @@ public static ActorSelection ActorSelection(ActorPath actorPath, ActorSystem sys public static ActorSelection ActorSelection(string path, ActorSystem system, ActorRef lookupRoot) { var provider = ((ActorSystemImpl)system).Provider; - if(Uri.IsWellFormedUriString(path, UriKind.Absolute)) - { - ActorPath actorPath; - if(!ActorPath.TryParse(path, out actorPath)) - return new ActorSelection(provider.DeadLetters, ""); - var actorRef = provider.RootGuardianAt(actorPath.Address); - return new ActorSelection(actorRef, actorPath.Elements); - } //no path given - if(string.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { return new ActorSelection(system.DeadLetters, ""); } //absolute path var elements = path.Split('/'); - if(elements[0] == "") + if (elements[0] == "") { return new ActorSelection(provider.RootGuardian, elements.Skip(1)); } + if(Uri.IsWellFormedUriString(path, UriKind.Absolute)) + { + ActorPath actorPath; + if(!ActorPath.TryParse(path, out actorPath)) + return new ActorSelection(provider.DeadLetters, ""); + + var actorRef = provider.RootGuardianAt(actorPath.Address); + return new ActorSelection(actorRef, actorPath.Elements); + } + return new ActorSelection(lookupRoot, path); } }