# Weird cygwin path mess

**URL:** https://discourse.julialang.org/t/weird-cygwin-path-mess/31375
**Category:** General Usage
**Created:** [November 22, 2019, 6:22am UTC](https://discourse.julialang.org/t/weird-cygwin-path-mess/31375 "2019-11-22T06:22:37Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)
#### Post date: [November 22, 2019, 6:22am UTC](https://discourse.julialang.org/t/weird-cygwin-path-mess/31375/1 "2019-11-22T06:22:38Z")

</div>

Julia is run in a cygwin window. It is

```julia
julia> versioninfo()
Julia Version 1.3.0-rc4.1
Commit 8c4656b97a (2019-10-15 14:08 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Core(TM) i7-4650U CPU @ 1.70GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, haswell)

```

Consider the following. Using the Julia function to change into a folder doesn’t work. The shell-mode CD doesn’t work either. The shell-mode listing of the folder works. Using a relative path works.

```julia
julia> cd("/cygdrive/c/Users/PK/Documents/work/advanced-finite-element-analysis-of-solids")
ERROR: IOError: chdir /cygdrive/c/Users/PK/Documents/work/advanced-finite-element-analysis-of-solids: no such file or directory (ENOENT)
Stacktrace:
 [1] uv_error at .\libuv.jl:97 [inlined]
 [2] cd(::String) at .\file.jl:84
 [3] top-level scope at REPL[1]:1

shell> cd /cygdrive/c/Users/PK/Documents/work/advanced-finite-element-analysis-of-solids
ERROR: IOError: chdir /cygdrive/c/Users/PK/Documents/work/advanced-finite-element-analysis-of-solids: no such file or directory (ENOENT)
Stacktrace:
 [1] uv_error at .\libuv.jl:97 [inlined]
 [2] cd(::String) at .\file.jl:84
 [3] repl_cmd(::Cmd, ::REPL.Terminals.TTYTerminal) at .\client.jl:61
 [4] top-level scope at REPL[1]:0

shell> ls /cygdrive/c/Users/PK/Documents/work/advanced-finite-element-analysis-of-solids
README.md thread_buffers.jl thread_buffers.jl~

shell> pwd
/cygdrive/c/Users/PK/Documents/work

julia> cd("./advanced-finite-element-analysis-of-solids\\")

shell> pwd
/cygdrive/c/Users/PK/Documents/work/advanced-finite-element-analysis-of-solids

julia>

```

Where does this come from, and how to fix it?

---

<div class="post-metadata">

### Author: ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)
#### Post date: [November 22, 2019, 9:55am UTC](https://discourse.julialang.org/t/weird-cygwin-path-mess/31375/2 "2019-11-22T09:55:10Z")

</div>

It is documented here:

[https://cygwin.com/cygwin-ug-net/using.html#using-pathnames](https://cygwin.com/cygwin-ug-net/using.html#using-pathnames)

Cf

[https://github.com/JuliaLang/julia/issues/24128](https://github.com/JuliaLang/julia/issues/24128)

If you are asking in relation to

[https://github.com/tpapp/julia-repl/issues/74](https://github.com/tpapp/julia-repl/issues/74)

I may be able to figure out a workaround in julia-repl.

---

<div class="post-metadata">

### Author: ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)
#### Post date: [November 22, 2019, 12:22pm UTC](https://discourse.julialang.org/t/weird-cygwin-path-mess/31375/3 "2019-11-22T12:22:48Z")

</div>

The Julia executable is still a native Windows build, so needs backslash for the path and Windows like drive letters:

```julia
julia> cd("/cygdrive/c/Users/oheil/Local Settings/Application Data/")
ERROR: IOError: chdir /cygdrive/c/Users/oheil/Local Settings/Application Data/: no such file or directory (ENOENT)
Stacktrace:
 [1] uv_error at .\libuv.jl:90 [inlined]
 [2] cd(::String) at .\file.jl:76
 [3] top-level scope at REPL[3]:1

```

but

```julia
julia> cd(raw"c:\Users\oheil\Local Settings\Application Data")

julia> pwd()
"c:\\Users\\oheil\\Local Settings\\Application Data"

```

You can help yourself with e.g. quick and dirty:

```julia
cd(replace(replace("/cygdrive/c/Users/oheil/Local Settings/Application Data","/" => "\\"),"\\cygdrive\\c" => "c:"))

```

but beware, a trailing / at the end of the path is not allowed with this simple example.  
I wouldn’t call it a mess, but yes, it is sometimes annoying.

---

<div class="post-metadata">

### Author: ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)
#### Post date: [November 22, 2019, 12:33pm UTC](https://discourse.julialang.org/t/weird-cygwin-path-mess/31375/4 "2019-11-22T12:33:20Z")

</div>

True, this is easy to fix by hand ([https://github.com/tpapp/julia-repl/issues/74#issuecomment-557484567](https://github.com/tpapp/julia-repl/issues/74#issuecomment-557484567)), but what is needed for a reasonable workflow in Emacs is either for Julia or for julia-repl to sort this out automatically (read without user intervention). Thanks to a fantastically responsive author (@Tamas_Papp; 😀 ), perhaps the latter will materialize!

---

<div class="post-metadata">

### Author: ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)
#### Post date: [November 22, 2019, 6:20pm UTC](https://discourse.julialang.org/t/weird-cygwin-path-mess/31375/5 "2019-11-22T18:20:18Z")

</div>

Yes, there is now

[https://github.com/tpapp/julia-repl/pull/76](https://github.com/tpapp/julia-repl/pull/76)

and feedback would be welcome.
