Jump to content
Developer Wiki and Function Reference Links ×

Creating Finder Folders and Director Folders


Sam Jones

Recommended Posts

Is there a way to create a finder folder in which to put the text files that one is writing.

 

I need to save a file in the user plug-ins folder.  I would normally do this by:

PlugInPath := GetFolderPath(-2);

FeederFile := CONCAT(PlugInPath,'FEEDER INVENTORY.xml’);

{… stuff …}

result := WriteXMLFile(hXML, -1, FeederFile);

 

But there will several files, so I tried:

PlugInPath := GetFolderPath(-2);

FeederFile := CONCAT(PlugInPath,’Inventory Folder:FEEDER INVENTORY.xml’); {<——Change is here}

{… stuff …}

result := WriteXMLFile(hXML, -1, FeederFile);

 

That did not seem to work.  Any suggestions?

 

TIA 

 

Sam

 

 

Link to comment

Sam,

This should work. The first time you use it a folder will be created in your Plug-ins folder. After that, new files will be placed in that folder. If you need to delete a folder when you're done with it, you'll probably need to use Python.

PROCEDURE CreateFileInNewFolder;
{ This program will create a new file AND a new folder, if it doesn't already exist, }
{ in the User's Plug-ins folder.  }
VAR
	parentF, XMLFolder, FName1 :String;
BEGIN
	parentF := GetFolderPath(-2);
	XMLFolder := 'New XML ƒ:';		{ using Mac file delimiter }
	FName1 := concat(parentF, XMLFolder, 'FEEDER INVENTORY.xml');
	
	ReWrite(FName1);
	WriteLn('Sam, I''m in here!!!');
	Close(FName1);
END;
RUN(CreateFileInNewFolder);

HTH,

Raymond

 

Edited by MullinRJ
Link to comment

Sam,

I see there is more to the problem than creating a new folder. I played with the XML part tonight and realize the FileIO calls have more flexibility than the XML-IO calls regarding paths. I'll look at it again tomorrow, but it will be later in the day. Perhaps Carlotta will chime in with her infinite wisdom regarding all things XML.

 

Raymond

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...