Skip to content

Commit

Permalink
Merge local branch
Browse files Browse the repository at this point in the history
  • Loading branch information
pedromxavier committed Oct 2, 2024
2 parents de06be7 + e204374 commit 532ba36
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Manifest.toml

# Distribution Files
dist/
qubolib/

# PythonCall
.CondaPkg
6 changes: 3 additions & 3 deletions Artifacts.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[qubolib]
git-tree-sha1 = "7dd4e0ff8e24c29964698c5bcdcb167a5bf5f11d"
git-tree-sha1 = "589afc4ab896a18e91989bfb46448e6859c7d041"
lazy = true

[[qubolib.download]]
url = "https://github.com/pedromxavier/QUBOLibData.jl/releases/download/v0.1.3/qubolib.tar.gz"
sha256 = "e4acf4fb9c07b139b4eda3a46429bf685a097051a73b489b2c2b063f6c0979ce"
url = "https://github.com/JuliaQUBO/QUBOLib.jl/releases/download/v0.1.0-dev0/qubolib.tar.gz"
sha256 = "fe76c53cf89075aa88c16ddde174f312f9917a10bf6a1900cbd2cdf3198c5d6f"

24 changes: 18 additions & 6 deletions src/library/access.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,33 @@ function access(callback::Any; path::AbstractString)
end

function access(; path::AbstractString = pwd())
if !is_installed(path)
install(path)
if !is_installed(library_path(path))
install(library_path(path))
end

return load_index(path)
return load_index(library_path(path))
end

function is_installed(path::AbstractString)::Bool
return isdir(path) && isfile(database_path(path)) && isfile(archive_path(path))
end

function install(path::AbstractString)
cp(library_path(), mkdir(library_path(path)); force = true)

chmod(library_path(path), 0o666; recursive = true)
mkdir(path)

for src_name in readdir(library_path())
src_path = abspath(library_path(), src_name)
dst_path = abspath(path, src_name)

cp(
src_path,
dst_path;
force = true,
follow_symlinks = true,
)

chmod(dst_path, 0o644)
end

return nothing
end
Expand Down

0 comments on commit 532ba36

Please sign in to comment.