Closed kgoulet closed 9 months ago
It took me a bit to figure out what exactly is happening, in short there is presumably a directory compose
in ...X11/locale
. Typically, a file cell's type is denoted by the file ending, .jl
for the Cell{:jl}
, for example.
In this case, compose
is a directory, and this is where the name compose.dir
is coming from, the Cell{:dir}
. I did a look around all of the functions that populate this. I think the issue stems from build_file_cell
.
function build_file_cell(e::Int64, path::String, dir::String)
if ~(isdir(dir * "/" * path))
splitdir::Vector{SubString} = split(path, "/")
fname::String = string(splitdir[length(splitdir)])
fsplit = split(fname, ".")
fending::String = ""
if length(fsplit) > 1
fending = string(fsplit[2])
end
Cell(e, fending, fname, replace(dir * "/" * path, "\\" => "/"))
else
Cell(e, "dir", path, dir)
end
end
Here, I think that dir * "/" * path
in the conditional is returning false, it is not a directory. I think, however, it is also not a file -- so Olive
thinks there is a file or directory there, but apparently there is not -- or something with the path or otherwise is incorrect. Until I can figure out why some of the names from readdir
are ... (I guess are just not existing in this instance, or have a different name when interpreted into Julia Strings
.) ... I will change this by basically just giving up if this is not a file.
function build_file_cell(e::Int64, path::String, dir::String)
fpath = dir * "/" * path
if ~(isdir(fpath))
if isfile(fpath)
splitdir::Vector{SubString} = split(path, "/")
fname::String = string(splitdir[length(splitdir)])
fsplit = split(fname, ".")
fending::String = ""
if length(fsplit) > 1
fending = string(fsplit[2])
end
Cell(e, fending, fname, replace(dir * "/" * path, "\\" => "/"))
else
return
end
else
Cell(e, "dir", path, dir)
end
end
Now this could cause a return of Nothing
, so I have to filter!
it in the function that calls this.
function directory_cells(dir::String = pwd(), access::Pair{String, String} ...)
files = readdir(dir)
return(filter!(e -> ~(isnothing(e)), [build_file_cell(e, path, dir) for (e, path) in enumerate(files)]::AbstractVector))
end
Also, the reason why this error was happening on load is because the sub-directory cells are made when the cell is made -- I don't really like that. While it means we don't have to rebuild cells everytime it is collapsed, it also means that we are holding those cells in memory -- and generating them on startup, I will change that as well.
on(c, filecell, "click") do cm::ComponentModifier
childs = Vector{Servable}([begin
build(c, mcell, d)
end
for mcell in directory_cells(cell.outputs * "/" * cell.source)])
if cm[filecell]["ex"] == "0"
style!(cm, childbox, "height" => "auto", "opacity" => 100percent)
cm[filecell] = "ex" => "1"
return
end
set_children!(cm, childbox, childs)
style!(cm, childbox, "opacity" => 0percent, "height" => 0percent)
cm[filecell] = "ex" => "0"
end
thought I would rebel and use childs.
@kgoulet I think that these changes to the file cell building should fix this odd issue; thanks for bringing this to my attention, I am still curious what the exact root causes are -- but either way I think it is great to have this exception case. I have made these changes on my fork of Olive
on branch #109 for this issue. I will also be merging this to emmaccode/Unstable
, so your Olive
will still update (albeit with Unstable
changes from my fork) if you want to add it from there.
julia> ]
pkg> add https://github.com/emmaccode/Olive.jl#109
pkg> add https://github.com/emmaccode/Olive.jl#Unstable
using Pkg; Pkg.add(url = "https://github.com/emmaccode/Olive.jl", rev = "109")
using Pkg; Pkg.add(url = "https://github.com/emmaccode/Olive.jl", rev = "Unstable")
Let me know if this has solved your issue, so I can close this. Thanks for the report and support ;)
Appears to be no longer an issue.
terminal output for the record.
julia> exit() kgoulet@linux-1:~$ julia _ _ _ _(_)_ | Documentation: https://docs.julialang.org (_) | (_) (_) | _ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help. | | | | | | |/ _
| |
| | || | | | (| | | Version 1.9.3 (2023-08-24)
/ |_'|||_'_| | Official https://julialang.org/ release
|__/ |
(@v1.9) pkg> add https://github.com/emmaccode/Olive.jl#109
Updating git-repo https://github.com/emmaccode/Olive.jl
Resolving package versions...
Updating ~/.julia/environments/v1.9/Project.toml
[724ecaf6] ~ Olive v0.0.9 https://github.com/ChifiSource/Olive.jl#main
⇒ v0.0.9 https://github.com/emmaccode/Olive.jl#109
Updating ~/.julia/environments/v1.9/Manifest.toml
[724ecaf6] ~ Olive v0.0.9 https://github.com/ChifiSource/Olive.jl#main
⇒ v0.0.9 https://github.com/emmaccode/Olive.jl#109
Precompiling project...
1 dependency successfully precompiled in 2 seconds. 274 already precompiled.
(@v1.9) pkg> add https://github.com/emmaccode/Olive.jl#Unstable
Updating git-repo https://github.com/emmaccode/Olive.jl
Resolving package versions...
Updating ~/.julia/environments/v1.9/Project.toml
[724ecaf6] ~ Olive v0.0.9 https://github.com/emmaccode/Olive.jl#109
⇒ v0.0.9 https://github.com/emmaccode/Olive.jl#Unstable
Updating ~/.julia/environments/v1.9/Manifest.toml
[724ecaf6] ~ Olive v0.0.9 https://github.com/emmaccode/Olive.jl#109
⇒ v0.0.9 https://github.com/emmaccode/Olive.jl#Unstable
(@v1.9) pkg>
julia> using Olive
julia> IP = "127.0.0.1" # same as default (see ?(Olive.start)) "127.0.0.1"
julia> PORT = 8000 8000
julia> startpath = "/home/kgoulet/olive" "/home/kgoulet/olive"
julia> Olive.start(IP, PORT, devmode = false, path = startpath)
Activating project at ~/olive/olive
[ Info: Listening on: 127.0.0.1:8000, thread id: 1 [2023:11:04:11:25]: 🫒 olive> link for kgou: http://127.0.0.1:8000/?key=zCO6kafmb2dXrKE7 Toolips.WebServer hosted at: http://127.0.0.1:8000 status: 4 routes 404 / /MaterialIcons.otf /favicon.ico /modifier/linker
extensions
Toolips.Logger
OliveCore ToolipsSession.Session
`
Sometimes I get a start screen and fill in some information, sometimes not, but this connection timeout seems to consistently appear. From the error message it seems that compose.dir is repeated twice. Also, compose.dir does not appear to be a directory but a file.
stacktrace.txt compose.dir.txt
More listings attached.
-----------------------Error message -----------------------