diff --git a/src/Utils/Utils.jl b/src/Utils/Utils.jl index a189a826..810e3bcc 100644 --- a/src/Utils/Utils.jl +++ b/src/Utils/Utils.jl @@ -26,8 +26,7 @@ export @block_id, convert_partition # Usability -export @filename_to_png, - @relpath +export @filename_to_png # internal conversion export template_direction_symbols, @@ -289,52 +288,6 @@ function source_path(default::Union{AbstractString, Nothing}="") end end -""" - @relpath(name) - -Returns the path of the current code file. - -### Input - -- `name` -- file name - -### Output - -A string. - -### Notes - -This macro is handy, e.g., when calling a function that uses a file relative to -its own location. - -For example, suppose that the folder `/home/projects/P1` contains the script `s.jl` -which loads the data `x.dat` and performs some calculations with it: - -```julia -# file /home/projects/P1/s.jl -d = open(@relpath "x.dat") -# do stuff with d -``` -In this example, the macro `@relpath "s.jl"` evaluates to the string -`/home/projects/P1/x.dat`. The script `s.jl` can be evaluated from the command line -from any folder, e.g. suppose that the path working directory is `/home/projects`, -then one can do `julia -e 'include("P1/s.jl")'` without having to change `s.jl`. -""" -macro relpath(name::String) - return quote - f = source_path() - if f == nothing - pathdir = "" - else - pathdir = join(split(f, "/")[1:end-1], "/") - end - if !isempty(pathdir) - pathdir = pathdir * "/" - end - pathdir * $name - end -end - """ convert_partition(partition::AbstractVector{<:AbstractVector{Int}})::Union{ Vector{Int}, Vector{UnitRange{Int}}, Vector{Union{UnitRange{Int}, Int}}}