aboutsummaryrefslogtreecommitdiff
path: root/platform.F90
diff options
context:
space:
mode:
authorJeffrey Armstrong <jeff@approximatrix.com>2020-08-10 18:02:04 -0400
committerJeffrey Armstrong <jeff@approximatrix.com>2020-08-10 18:02:04 -0400
commit7b8f2ab32f66d8f3ce48a5e9685c05b25d31f2bb (patch)
tree64e548693c90b65da6ee400cf9476af4b8aa9c16 /platform.F90
parent48fad229ae1f033e694a7eb663945a6a3f1f4cb2 (diff)
downloadLR-87-7b8f2ab32f66d8f3ce48a5e9685c05b25d31f2bb.zip
LR-87-7b8f2ab32f66d8f3ce48a5e9685c05b25d31f2bb.tar.gz
Fixed favorite loading that caused string filling and pointer crashes. Now calls win32 CreateDirectory on Windows. Fixed Fave button on Windows.
Diffstat (limited to 'platform.F90')
-rw-r--r--platform.F9020
1 files changed, 19 insertions, 1 deletions
diff --git a/platform.F90 b/platform.F90
index 7fbe389..7c864b1 100644
--- a/platform.F90
+++ b/platform.F90
@@ -12,12 +12,30 @@ implicit none
contains
subroutine make_directory(dir)
+ use iso_c_binding
implicit none
character(*), intent(in)::dir
#ifdef WINDOWS
- call execute_command_line('mkdir "'//trim(dir)//'"')
+ character(kind=c_char, len=:), allocatable, target::passdir
+ interface
+ function CreateDirectory(dir, ignored) bind(c, name="CreateDirectoryA")
+ use iso_c_binding
+ type(c_ptr), value::dir
+ type(c_ptr), value::ignored
+ integer(kind=c_int)::CreateDirectory
+ end function CreateDirectory
+ end interface
+
+ allocate(character(len=(len_trim(dir)+1)) :: passdir)
+ passdir = trim(dir)//c_null_char
+ if(CreateDirectory(c_loc(passdir), c_null_ptr) == 0) then
+ print *, "Could not create directory, maybe exists?"
+ end if
+ deallocate(passdir)
+
+ !call execute_command_line('mkdir "'//trim(dir)//'"')
#else
call execute_command_line('mkdir -p "'//trim(dir)//'"')
#endif