This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallAnywhere
- :
- InstallAnywhere Forum
- :
- Re: Problem using Modify Text File to create a new file
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 20, 2010
08:58 AM
Problem using Modify Text File to create a new file
Hi, I'm trying to create a new 'links' directory on the Windows filesystem and create a new text file within it which contains just one line.
I am attempting this in the Post-Install section of IA2010, by using Execute Command (to run mkdir to create the new 'links' directory) and then Modify Text File with the New file radio button selected (to create a new file called 'myfile.link' within the new 'links' directory, containing the one line of text I want).
However, when I run the installer there is a problem with creating the new file because it says it cannot find the new directory - even though it was created OK (and I have confirmed it was created on the filesystem).
Here is the relevant snippet from the install.log file (note that C:\Temp already exists on the filesystem before running the installer):
Execute Command: cmd.exe /c mkdir "C:\Temp\links"
Status: SUCCESSFUL
Modify Text File - Single File: New File C:\Temp\links\myfile.link
Status: ERROR
Additional Notes: ERROR - java.io.FileNotFoundException: parent did not exist when attempting touch on path: C:\Temp\links\myfile.link
Is this a timing issue?
I have tried seperating the two commands into different Action Groups - but get the same problem as above.
However, I have tried creating the C:\Temp\links directory myself before running the installer - and then the new file 'myfile.links' is then created successfully.
The above problem only occurs if I let the installer create the new 'links' directory before attempting to create the new file.
It is like the Execute Command does not complete before the Modify Text File is attempted. Wierd!
Does anyone know what I'm doing wrong, or how else I can create a new text file within a new directory, as part of the post-install?
Thanks.
I am attempting this in the Post-Install section of IA2010, by using Execute Command (to run mkdir to create the new 'links' directory) and then Modify Text File with the New file radio button selected (to create a new file called 'myfile.link' within the new 'links' directory, containing the one line of text I want).
However, when I run the installer there is a problem with creating the new file because it says it cannot find the new directory - even though it was created OK (and I have confirmed it was created on the filesystem).
Here is the relevant snippet from the install.log file (note that C:\Temp already exists on the filesystem before running the installer):
Execute Command: cmd.exe /c mkdir "C:\Temp\links"
Status: SUCCESSFUL
Modify Text File - Single File: New File C:\Temp\links\myfile.link
Status: ERROR
Additional Notes: ERROR - java.io.FileNotFoundException: parent did not exist when attempting touch on path: C:\Temp\links\myfile.link
Is this a timing issue?
I have tried seperating the two commands into different Action Groups - but get the same problem as above.
However, I have tried creating the C:\Temp\links directory myself before running the installer - and then the new file 'myfile.links' is then created successfully.
The above problem only occurs if I let the installer create the new 'links' directory before attempting to create the new file.
It is like the Execute Command does not complete before the Modify Text File is attempted. Wierd!
Does anyone know what I'm doing wrong, or how else I can create a new text file within a new directory, as part of the post-install?
Thanks.
(4) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 20, 2010
10:59 AM
Why can't you do this in the Install section, maybe as a last action, it might be easier to create the links folder (you've got a built-in action for that in the Install task).
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 20, 2010
11:11 AM
pv7721 wrote:
Why can't you do this in the Install section, maybe as a last action, it might be easier to create the links folder (you've got a built-in action for that in the Install task).
Hi Vlad,
thanks for the reply. I deemed it more of a Post-install activity so decided to put it in there.
I have however previously tried creating the new 'links' directory in the Install section as you suggest, using the Create Folder action. The problem with that is that no matter what destination path I choose in the drop down box (e.g. Temp directory), the directory path field to the right of it always shows '\' and is greyed out so I cannot enter the necessary 'C:\Temp\links' that I would like to. Do you know of any way around this so that I can enter a path of my choosing? If so I could do the create directory in the Install section as you suggest.
Thanks,
Brian.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 21, 2010
12:43 AM
And this path of yours is somewhere completely out of the user installation folder?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 21, 2010
04:42 AM
pv7721 wrote:
And this path of yours is somewhere completely out of the user installation folder?
Yes it is completely out of the user install folder. Is that not possible then? I hoped I would be able to create a folder anywhere on the filesystem using the Create Folder action.
However I have managed to find a solution - your comment triggered me into thinking that I needed to use a user variable to access outside of the user install folder.
In the Install section I set variable $USER_MAGIC_FOLDER_1$ to the pathname I want on the filesystem (C:\Temp), and then use the Create Folder action, specifying that variable as the destination path and then entering 'links' as the name of the new folder to create.
Then in the Post-install section I use the Modify Text File action to create the new file, and this time the command succeeds because it can find the newly created folder.
I still don't understand why I hit the original problem - where it says the mkdir completed successfully but then can't touch ther parent folder when attempting to create the new file - looks like a bug in InstallAnywhere to me?
Bu anyway the solution is not altogether very intuitive - but it works!
Thanks for the help.