diff --git a/src/Adaptive.Aeron/Aeron.cs b/src/Adaptive.Aeron/Aeron.cs
index 66b14431..a58d01cd 100644
--- a/src/Adaptive.Aeron/Aeron.cs
+++ b/src/Adaptive.Aeron/Aeron.cs
@@ -411,6 +411,28 @@ public class Context : IDisposable
private UnsafeBuffer _countersValuesBuffer;
private IThreadFactory _threadFactory = new DefaultThreadFactory();
+
+ static Context()
+ {
+ string baseDirName = null;
+
+ if (Environment.OSVersion.Platform == PlatformID.Unix)
+ {
+ if (Directory.Exists(@"/dev/shm"))
+ {
+ baseDirName = "/dev/shm/aeron";
+ }
+ }
+
+ if (null == baseDirName)
+ {
+ baseDirName = Path.Combine(Path.GetTempPath(), "aeron");
+ }
+
+ AERON_DIR_PROP_DEFAULT = baseDirName + '-' + Environment.UserName;
+
+ }
+
///
/// The top level Aeron directory used for communication between a Media Driver and client.
///
@@ -419,8 +441,7 @@ public class Context : IDisposable
///
/// The value of the top level Aeron directory unless overridden by
///
- public static readonly string AERON_DIR_PROP_DEFAULT =
- Path.Combine(IoUtil.TmpDirName(), "aeron-" + Environment.UserName);
+ public static readonly string AERON_DIR_PROP_DEFAULT;
///
/// Media type used for IPC shared memory from to channels.
diff --git a/src/Adaptive.Agrona/IoUtil.cs b/src/Adaptive.Agrona/IoUtil.cs
index 175430e2..c6d1a07f 100644
--- a/src/Adaptive.Agrona/IoUtil.cs
+++ b/src/Adaptive.Agrona/IoUtil.cs
@@ -196,20 +196,6 @@ public static void CheckFileExists(string path)
}
}
- ///
- /// Return the system property for java.io.tmpdir ensuring a '/' is at the end.
- ///
- /// tmp directory for the runtime
- public static string TmpDirName()
- {
- if (Environment.OSVersion.Platform == PlatformID.Unix)
- {
- return @"/dev/shm";
- }
-
- return Path.GetTempPath();
- }
-
public static void Delete(DirectoryInfo directory, bool b)
{
if (directory.Exists)