Recent

Author Topic: [SOLVED] ForceDirectories in Lazarus 64 bits problems...  (Read 8923 times)

Fred vS

  • Hero Member
  • *****
  • Posts: 3876
    • StrumPract is the musicians best friend
[SOLVED] ForceDirectories in Lazarus 64 bits problems...
« on: September 21, 2011, 10:55:54 pm »
Hello everybody.
I have troubles with ForceDirectories in Lazarus 64 bits :
the directory is not created  %)
Here a sample to demonstrate it :
Create a new application with a button :

Code: [Select]
unit Unitcreatedir;

{$mode objfpc}{$H+}

interface

uses

SysUtils, Forms, Dialogs, StdCtrls; 

type

  { TForm1 }

  TForm1 = class(TForm)
    Button1: TButton;

  procedure Button1Click(Sender: TObject);


  private

    { private declarations }

  public

    { public declarations }

  end;

var
Form1: TForm1;

implementation

{$R *.lfm}

{ TForm1 }

procedure TForm1.Button1Click(Sender: TObject);
begin
    MessageDlg('Init of testing'  ,mtInformation, [mbYes], 0)  ;

  if DirectoryExists(pchar('C:\Program Files\test')) then else

       ForceDirectories(pchar('C:\Program Files\test'));

   if DirectoryExists(pchar('C:\Program Files\test')) then

   MessageDlg('\test\ exists...'  ,mtInformation, [mbYes], 0)

   else MessageDlg('\test\ do not exist...'  ,mtWarning, [mbYes], 0) ;

 if DirectoryExists(pchar('C:\Program Files\test')) then

 removedir(pchar('C:\Program Files\test')) ;
end;

end.

With Lazarus 32 bits, the directory test is created.  ;)

With Lazarus 64 bits, the directory test is NOT created.  :o

Thanks for helping...

« Last Edit: September 22, 2011, 04:21:09 pm by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: ForceDirectories in Lazarus 64 bits problems...
« Reply #1 on: September 21, 2011, 11:32:09 pm »
Try the BugTracker.

Fred vS

  • Hero Member
  • *****
  • Posts: 3876
    • StrumPract is the musicians best friend
Re: ForceDirectories in Lazarus 64 bits problems...
« Reply #2 on: September 22, 2011, 03:43:57 am »
@ Typo

I do not know how to use Bugtracker, i do not find how to add a new bug ...  %)
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: ForceDirectories in Lazarus 64 bits problems...
« Reply #3 on: September 22, 2011, 11:23:22 am »
IIRC, the button/link is called something like "Report an issue". I think you need to have an account on the bugtracker first.

Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

JohnvdWaeter

  • Full Member
  • ***
  • Posts: 185
    • http://www.jvdw.nl
Re: ForceDirectories in Lazarus 64 bits problems...
« Reply #4 on: September 22, 2011, 01:35:28 pm »
I *think* it's a windows issue... the folder is probably not really created below Program Files. It's only made visible there for users and programs, but creating folders in the program-folders directory is normally forbidden, except for elevated setup-programs.

Windows  more or less allowed the creation, but these folders are created in the users virtual space.
I think Win64 bit version simply does not allow it anymore.

To see if 64 bit Forcedirectories work, try to create a folder manually (in Explorer) like C:\test
Then grant proper rights to this folder.
Now try if 64 bits lazarus prog can create folders inside this c:\test

fwiw ;-)
John

Fred vS

  • Hero Member
  • *****
  • Posts: 3876
    • StrumPract is the musicians best friend
Re: ForceDirectories in Lazarus 64 bits problems...
« Reply #5 on: September 22, 2011, 03:41:56 pm »
@ John
Hum, it is just what im thinking.
OK, the answer is : forget to create folders or directories in C:\program files with Windows 7.
I gonna change it to C:\myprogram_data (there no problems).   ::)

Thanks
« Last Edit: September 22, 2011, 06:35:38 pm by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

User137

  • Hero Member
  • *****
  • Posts: 1791
    • Nxpascal home
Re: [SOLVED] ForceDirectories in Lazarus 64 bits problems...
« Reply #6 on: September 22, 2011, 04:50:51 pm »
Windows lets you have spaces in path names sometimes only if full path is in " ".

 

TinyPortal © 2005-2018