Author Topic: getting path on found using mkdir  (Read 3240 times)

0 Members and 1 Guest are viewing this topic.

Offline badger

  • Forum Regular
  • Posts: 148
    • View Profile
getting path on found using mkdir
« on: October 07, 2020, 02:55:25 pm »
Hello

i was wonder why the following code does not create the directory.

Badger

iflag is an integer

Code: QB64: [Select]
  1. iflag = _DIREXISTS("c:\program files\jbridal\data")
  2.  
  3. IF iflag = 0 THEN MKDIR "c:\program files\jbridal\data"
  4.  

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: getting path on found using mkdir
« Reply #1 on: October 07, 2020, 03:15:31 pm »
Do you need to MKDIR “c:\program files\jbridal” first?
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline badger

  • Forum Regular
  • Posts: 148
    • View Profile
Re: getting path on found using mkdir
« Reply #2 on: October 07, 2020, 03:23:07 pm »
SMcNeill

here is the whole module i guess i should have posted this in the first place sorry

but jbridal does exists program will end if not there.

Code: QB64: [Select]
  1.  
  2. dircheck:
  3. SELECT CASE _DIREXISTS("c:\program files\jbridal")
  4.         CASE -1:
  5.                 idirflag = -1
  6.         CASE 0:
  7.                 idirflag = 0
  8.  
  9. IF idirflag = 0 THEN
  10.         BEEP
  11.         CLS
  12.         LOCATE 12, 27
  13.         PRINT "Home Director Does not Exists"
  14.         LOCATE 13, 23: PRINT "Please Create c:\program files\jbridal"
  15.         LOCATE 14, 30: PRINT "And Rerun The program"
  16.         LOCATE 16, 32: PRINT "Enter to continue"
  17.         LINE INPUT st
  18.         CLOSE
  19.         END
  20.  
  21. iflag = _DIREXISTS("c:\program files\jbridal\data")
  22. IF iflag = 0 THEN MKDIR "c:\program files\jbridal\data"
  23.  
  24. iflag = _DIREXISTS("c:\program files\jbridal\data\custdesc")
  25. IF iflag = 0 THEN MKDIR "c:\program file\jbridal\data\custdesc"
  26.  
  27. iflag = _DIREXISTS("c:\program files\jbridal\data\invdesc")
  28. IF iflag = 0 THEN MKDIR "c:\program files\jbridal\data\invdesc"
  29.  
  30. iflag = _DIREXISTS("c:\program files\jbridal\data\posdesc")
  31.  
  32. IF iflag = 0 THEN MKDIR "c:\program files\jbridal\data\posdesc"
  33.  
  34.  

Offline badger

  • Forum Regular
  • Posts: 148
    • View Profile
Re: getting path on found using mkdir
« Reply #3 on: October 07, 2020, 03:45:27 pm »
SMneil

I modified what i posted here is the modified module

Badger
Code: QB64: [Select]
  1. dircheck:
  2. SELECT CASE _DIREXISTS("c:\program files\jbridal")
  3.         CASE -1:
  4.                 GOTO dirchk1
  5.         CASE 0:
  6.                 BEEP
  7.                 CLS
  8.                 LOCATE 12, 27
  9.                 PRINT "Home Director Does not Exists"
  10.                 LOCATE 13, 23: PRINT "Please Create c:\program files\jbridal"
  11.                 LOCATE 14, 30: PRINT "And Rerun The program"
  12.                 LOCATE 16, 32: PRINT "Enter to continue"
  13.                 LINE INPUT st
  14.                 CLOSE
  15.  
  16. dirchk1:
  17.  
  18. iflag = _DIREXISTS("c:\program files\jbridal\data")
  19. IF iflag = 0 THEN MKDIR "c:\program files\jbridal\data"
  20.  
  21. iflag = _DIREXISTS("c:\program files\jbridal\data\db")
  22. IF iflag = 0 THEN MKDIR "c:\program files\jbridal\data\db"
  23.  
  24. iflag = _DIREXISTS("c:\program files\jbridal\data\custdesc")
  25. IF iflag = 0 THEN MKDIR "c:\program files\jbridal\data\custdesc"
  26.  
  27. iflag = _DIREXISTS("c:\program files\jbridal\data\invdesc")
  28. IF iflag = 0 THEN MKDIR "c:\program files\jbridal\data\invdesc"
  29.  
  30. iflag = _DIREXISTS("c:\program files\jbridal\data\posdesc")
  31. IF iflag = 0 THEN MKDIR "c:\program files\jbridal\data\posdesc"
  32.  
  33.  

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: getting path on found using mkdir
« Reply #4 on: October 07, 2020, 04:07:06 pm »
Hello

i was wonder why the following code does not create the directory.

Badger

iflag is an integer

Code: QB64: [Select]
  1. iflag = _DIREXISTS("c:\program files\jbridal\data")
  2.  
  3. IF iflag = 0 THEN MKDIR "c:\program files\jbridal\data"
  4.  

Windows has some new rules about access to your own dang computer ie no access allowed to Program files, at least through QB64 to make a directory.

Try this to get the working directory you are allowed access:
Code: QB64: [Select]
  1. _CLIPBOARD$ = _CWD$ 'sto current directory into clipboard
  2.  

Paste into IDE and make a directory off that. I did that after not being allowed access c:\program files to add bplus folder through QB64.
« Last Edit: October 07, 2020, 04:13:12 pm by bplus »

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: getting path on found using mkdir
« Reply #5 on: October 07, 2020, 04:11:59 pm »
Or use C:/ProgramData/   That’s where most read/write data access is stored for programs usually. 
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline badger

  • Forum Regular
  • Posts: 148
    • View Profile
Re: getting path on found using mkdir
« Reply #6 on: October 07, 2020, 04:24:18 pm »
SMcNeill

thanks i will try all to see what i can get done

Badger

Offline badger

  • Forum Regular
  • Posts: 148
    • View Profile
Re: getting path on found using mkdir
« Reply #7 on: October 07, 2020, 04:33:52 pm »
SMcNeill

something i was doing wrong. I had to move qb64 to the c:\program files\jbridal directory then it work fine anc created all the directories i needed..   but i had to run qb64 in admin mode

Badger

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: getting path on found using mkdir
« Reply #8 on: October 07, 2020, 06:01:55 pm »
I would NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER put any of my big programs in the Windows program files folder. I always name my project then I make a folder on my hard drive using that name.

Why? So some dumb-ASCII Windows Update is less likely to mess them up if such an update were to mess with Windows folders. Also, to avoid running as admin, etc., or any other restrictions.

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: getting path on found using mkdir
« Reply #9 on: October 07, 2020, 06:09:43 pm »
I would NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER, NEVER put any of my big programs in the Windows program files folder. I always name my project then I make a folder on my hard drive using that name.

Why? So some dumb-ASCII Windows Update is less likely to mess them up if such an update were to mess with Windows folders. Also, to avoid running as admin, etc., or any other restrictions.

Pete

+1

Windows has a set structure to it.  Program Files isn’t the place to be read/writing to.  Use ProgramData or User/AppData instead.  You’ll think yourself later, with all the issues from folder permissions you won’t be having.
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline badger

  • Forum Regular
  • Posts: 148
    • View Profile
Re: getting path on found using mkdir
« Reply #10 on: October 08, 2020, 02:00:39 pm »
Hello

I think i get the messages LMBO. I moved it all to my home directory c:\users\sureshot\jbridal.

here is a question is there away to bring in the present path so the program knows what the home directory is called

Badger

Offline badger

  • Forum Regular
  • Posts: 148
    • View Profile
Re: getting path on found using mkdir
« Reply #11 on: October 08, 2020, 02:03:32 pm »
Hello

after some reading i think _csd$ is my cause thanks guys

Badger