Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Version numbers

Posted on 2000-03-09
12
Medium Priority
?
149 Views
Last Modified: 2010-04-04
Has anyone found any code that puts version numbers on any file, and not just the *.exe (Delphi code if possible).
Is there any where on a text file or any file that I can store a 16 bit number.
0
Comment
Question by:abuela
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +3
12 Comments
 
LVL 10

Expert Comment

by:Lischke
ID: 2600039
Hi abuela,

I think you are asking too much. Where will you store version information, say, for a text file? There is no room planned to keep version information in other then exe, dll, vxd etc. files. So you have no other choice than to live with that...

Ciao, Mike
0
 

Author Comment

by:abuela
ID: 2600144
Edited text of question.
0
 
LVL 2

Expert Comment

by:florisb
ID: 2600181
hmmm, saving projects in a structure like:

dev/projectX/version0.1
dev/projectX/version0.2
dev/projectX/version0.3
with the latest version in
dev/projectX/

works good.


What do you want to accomplish?

Floris.

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 10

Expert Comment

by:Lischke
ID: 2600215
If you don't want to have the 16bit number appearing in any text editor than you cannot assign such a number to a text file. Floris' suggestion is ok, as well as using the file data stamp.

Ciao, Mike
0
 
LVL 9

Accepted Solution

by:
ITugay earned 800 total points
ID: 2600216
At first look it impossible, but you may try to store it just after the end of the  file.  You must be careful, recreating file you mark by this way will clear you version label.

Cheers,
Igor.
0
 
LVL 2

Expert Comment

by:florisb
ID: 2600294
There is a tool you can use to change the properties of all files in a directory, with this you can easily set all descriptions in one directory. I have it at home.

Floris.
0
 
LVL 1

Expert Comment

by:runebj
ID: 2600354
You could also do what we did in the old (DOS) days and put the version number in the "time" field for the file... all Version 1.0 files "created" at 1:00PM,  Version 1.5 at 1:50PM etc. (just don't make a version 1.7)

runebj
0
 

Expert Comment

by:brunohe
ID: 2600465
I think there's a possibility on the NTFS-level to save save a file-specific stream on the disk. Don't aks me how it works or about a source snippet.... (see NT Internals)
0
 

Author Comment

by:abuela
ID: 2612056
Do you know how to append version info to the end of the file.
0
 
LVL 9

Expert Comment

by:ITugay
ID: 2612079
OK, I show you sample, just a moment....


0
 
LVL 9

Expert Comment

by:ITugay
ID: 2612176
Hi,
The code is bellow:

const VersionPrefix = $1234DC1A;  // some unical value, used as version prefix

// result is cureent version if present, or -1 if no version label
function GetFileVersion(aFileName : string) : integer;
var F : TFileStream;
    U,V : integer;
begin
  result:=-1;
  F:=TFileStream.Create(aFileName,fmOpenRead);
  F.Seek(-SizeOf(Integer)*2,2);
  F.Read(U,SizeOf(Integer));
  if U = VersionPrefix // have a version prefix?
     then F.Read(result,SizeOf(Integer));
  F.Free;
end;

// set version to file, true if success
function SetFileVersion(aFileName : string; aVersion : integer) : boolean;
var F   : TFileStream;
    U,V : integer;
begin
   result:=false;
   V:=GetFileVersion(aFileName); // have a version?
   if V = aVersion then result:=true else
   try // set version if file have no version or have different from aVersion
     F:=TFileStream.Create(aFileName,fmOpenWrite);
     if V >= 0
        then F.Seek(-SizeOf(Integer)*2,2)
        else F.Seek(0,2);
     U:=VersionPrefix;
     F.Write(U,SizeOf(Integer));
     F.Write(aVersion,SizeOf(Integer));
     F.Free;
     result:=true;
   except end;
end;

//---------------------------------
Best regrads,
Igor.

PS: it will add some extra characters in text files.
0
 

Author Comment

by:abuela
ID: 2612212
Thanks for the code.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

598 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question