Skip to content

Commit

Permalink
Merge branch 'jn/mydocuments'
Browse files Browse the repository at this point in the history
  • Loading branch information
vtjnash committed Oct 15, 2013
2 parents 14feaa0 + f291b85 commit a963262
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
14 changes: 13 additions & 1 deletion base/path.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
splitdrive(path::String) = ("",path)
user_homedir() = ENV["HOME"]
user_prefdir() = user_homedir()
user_documentsdir() = @osx ? joinpath(user_homedir(),"Documents") : user_homedir()
end
@windows_only begin
const path_separator = "\\"
Expand All @@ -23,7 +24,18 @@ end
bytestring(m.captures[1]), bytestring(m.captures[2])
end
user_homedir() = get(ENV,"HOME",joinpath(ENV["HOMEDRIVE"],ENV["HOMEPATH"]))
user_prefdir() = get(ENV,"HOME",joinpath(ENV["AppData"],"Julia"))
user_prefdir() = user_homedir()
function user_documentsdir()
#HRESULT result = SHGetFolderPath(NULL, CSIDL_PERSONAL, NULL, SHGFP_TYPE_CURRENT, my_documents);
path = Array(Uint8,260)
result = ccall((:SHGetFolderPathA,:shell32),stdcall,Cint,
(Ptr{Void},Cint,Ptr{Void},Cint,Ptr{Uint8}),0,0x0005,0,0,path)
if result == 0
return bytestring(path[1:findfirst(path,0)-1])
else
return user_homedir()
end
end
end

isabspath(path::String) = ismatch(path_absolute_re, path)
Expand Down
3 changes: 1 addition & 2 deletions base/pkg/dir.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ module Dir
import Base.Git
import ..Pkg: DEFAULT_META, META_BRANCH

@unix_only const DIR_NAME = ".julia"
@windows_only const DIR_NAME = "packages"
const DIR_NAME = ".julia"

function path()
b = abspath(get(ENV,"JULIA_PKGDIR",joinpath(Base.user_prefdir(),DIR_NAME)))
Expand Down
8 changes: 5 additions & 3 deletions ui/repl-readline.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#ifdef __WIN32__
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
# include <shlobj.h>
#endif

extern int asprintf(char **strp, const char *fmt, ...);
Expand Down Expand Up @@ -58,9 +59,10 @@ static void init_history(void)
if (!home) return;
asprintf(&history_file, "%s/.julia_history", home);
#else
char *home = getenv("AppData");
if (!home) return;
asprintf(&history_file, "%s/julia/history", home);
char *homedrive = getenv("HOMEDRIVE");
char *homepath = getenv("HOMEPATH");
if (!homedrive || !homepath) return;
asprintf(&history_file, "%s/%s/.julia_history", homedrive, homepath);
#endif
}
}
Expand Down

0 comments on commit a963262

Please sign in to comment.