Guest User

Untitled

a guest
Sep 14th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. def get_default_ipc_path(testnet=False):
  2. if testnet:
  3. testnet = "testnet"
  4. else:
  5. testnet = ""
  6.  
  7. if sys.platform == 'darwin':
  8. ipc_path = os.path.expanduser(os.path.join(
  9. "~",
  10. "Library",
  11. "Ethereum",
  12. testnet,
  13. "geth.ipc"
  14. ))
  15. if os.path.exists(ipc_path):
  16. return ipc_path
  17.  
  18. ipc_path = os.path.expanduser(os.path.join(
  19. "~",
  20. "Library",
  21. "Application Support",
  22. "io.parity.ethereum",
  23. "jsonrpc.ipc"
  24. ))
  25. if os.path.exists(ipc_path):
  26. return ipc_path
  27.  
  28. elif sys.platform.startswith('linux') or sys.platform.startswith('freebsd'):
  29. ipc_path = os.path.expanduser(os.path.join(
  30. "~",
  31. ".ethereum",
  32. testnet,
  33. "geth.ipc"
  34. ))
  35. if os.path.exists(ipc_path):
  36. return ipc_path
  37.  
  38. ipc_path = os.path.expanduser(os.path.join(
  39. "~",
  40. ".local",
  41. "share",
  42. "io.parity.ethereum",
  43. "jsonrpc.ipc"
  44. ))
  45. if os.path.exists(ipc_path):
  46. return ipc_path
  47.  
  48. elif sys.platform == 'win32':
  49. ipc_path = os.path.join(
  50. "\\",
  51. ".",
  52. "pipe",
  53. "geth.ipc"
  54. )
  55. if os.path.exists(ipc_path):
  56. return ipc_path
  57.  
  58. ipc_path = os.path.join(
  59. "\\",
  60. ".",
  61. "pipe",
  62. "jsonrpc.ipc"
  63. )
  64. if os.path.exists(ipc_path):
  65. return ipc_path
Add Comment
Please, Sign In to add comment