CoCreate User Forum  

Go Back   CoCreate User Forum > Support > Customization

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 04-01-2005, 01:22 AM
andrea andrea is offline
Registered User
 
Join Date: Sep 2003
Location: italy
Posts: 260
function that me controls the existence a file

It exists in me10 a function that me controls the existence of a direttory or a file and in case I does not exist creates?

Sorry for my English bad.
Reply With Quote
  #2  
Old 04-01-2005, 03:33 AM
clausb's Avatar
clausb clausb is offline
Registered User
 
Join Date: Nov 2002
Posts: 1,168
Re: function that me controls the existence a file

Check out your LISP manual. For files, the LISP open function does what you want - see http://www.lisp.org/HyperSpec/Body/fun_open.html. For example:
Code:
  (setf s (open "foobar" :direction :output :if-does-not-exist :create))
For directories, either use LISP's directory command, or one of the file/directory handling functions documented in the Developer's Kit.

Claus
__________________
CoCreate Modeling FAQ: http://www.clausbrod.de/CoCreateModeling/
Reply With Quote
  #3  
Old 04-01-2005, 03:35 AM
andrea andrea is offline
Registered User
 
Join Date: Sep 2003
Location: italy
Posts: 260
Re: function that me controls the existence a file

For macro in to ME10 ???????
Reply With Quote
  #4  
Old 04-01-2005, 05:39 AM
clausb's Avatar
clausb clausb is offline
Registered User
 
Join Date: Nov 2002
Posts: 1,168
Re: function that me controls the existence a file

Oops - sorry. I should be reading those posts more carefully 8-(

I don't know too much about OSDD's macro language, but the CREATE_DIRECTORY command might do what you need for directories. If the directory doesn't exist already, it will create it, otherwise issue an error (which you can probably catch using TRAP_ERROR).

For files, OPEN_OUTFILE with option DEL_OLD might do the trick.

Sorry again for the misunderstanding.

Claus
__________________
CoCreate Modeling FAQ: http://www.clausbrod.de/CoCreateModeling/
Reply With Quote
  #5  
Old 04-01-2005, 01:24 PM
John Scheffel's Avatar
John Scheffel John Scheffel is offline
Administrator
 
Join Date: Sep 2002
Location: San Jose, CA
Posts: 1,288
Re: function that me controls the existence a file

There may be a better way, but some of our macros use logic like this to test for the existence of a file.
Code:
LET Test_file_name 'C:\my_file.txt'
TRAP_ERROR
OPEN_INFILE 1 Test_file_name END
IF (CHECK_ERROR) {file does not exist}
  OPEN_OUTFILE 1 Test_file_name 
  Commands...
ELSE {file exists}
  CLOSE_FILE 1
  Commands...
END_IF
__________________
John Scheffel
Reply With Quote
  #6  
Old 04-03-2005, 10:34 PM
andrea andrea is offline
Registered User
 
Join Date: Sep 2003
Location: italy
Posts: 260
Thumbs up Re: function that me controls the existence a file

thank you very much!
Reply With Quote
  #7  
Old 04-02-2018, 12:15 AM
Shaba's Avatar
Shaba Shaba is offline
Registered User
 
Join Date: Nov 2006
Location: Italy
Posts: 215
Re: function that me controls the existence a file

Good also for me!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 03:47 PM.



Hosted by SureServer    Forums   Modeling FAQ   Macro Site   Vendor/Contractors   Software Resellers   CoCreate   Gallery   Home   Board Members   Regional User Groups  By-Laws  

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.