Library naming conventions in Linux

Linux specific questions.
Dinosaur
Posts: 1481
Joined: Jul 24, 2005 1:13
Location: Hervey Bay (.au)

Re: Library naming conventions in Linux

Post by Dinosaur »

Hi All

MrSwiss, case sensitivity is the biggest bugbear of Linux.
I haven't worked out what kind of system I should adopt to overcome that.
1.Make everything lower case
2.First letter upper case
3.Always file extension in lower case
etc
Etc
etC

Regards
Dinosaur
Posts: 1481
Joined: Jul 24, 2005 1:13
Location: Hervey Bay (.au)

Re: Library naming conventions in Linux

Post by Dinosaur »

Hi All

caseih, the reason for the program not finding the files was a string length error.
Knowing that my program works perfectly in Dos & Windows without changing a single char,
I got cocky and looked everywhere else.
Having to put a long path name like "/home/dinosaur/hmi" got me over the limit of the string and the file search failed.

Now that I have overcome that, (I am progressing) I do get a seg violation the moment I try to use the Allegro "Blit" routine.

Code: Select all

'Create & register the Bitmaps.
For Xq  = 0 To 31
      Led.bmp(Xq)  = create_bitmap(15,15) 
      Lock_BitMap(Led.Bmp(Xq))                  		'create space for bmp
      Led.Naam(Xq) = "Led" + Str(Xq)                  'give it a unique name
     Tabs.Tryit = RegisterImage(Led.bmp(Xq),Led.Naam(Xq), Cgui_IMAGE_BMP, Led.Button(Xq)) 
     If Tabs.Tryit = 0 Then .Level = 2				'Register the Name to the id from Tag.
Next                                    
For Xq = 0 To 7
      Blit(ipOff,Led.Bmp(Xq),0,0,0,0,15,15)           'start by having all led's off
     Tabs.Tryit = RegisterImage(Led.bmp(Xq),"ipOff", Cgui_IMAGE_BMP, Led.Button(Xq)) 
     If Tabs.Tryit = 0 Then .Level = 2
     Led.Direction(Xq) = -1							'1 = O/P -1 = I/P
Next
However, CGUI has been tested up to Allegro 4.2 and I am using Allegro 4.4.2, so may have to compile the earlier library.

Regards
caseih
Posts: 2157
Joined: Feb 26, 2007 5:32

Re: Library naming conventions in Linux

Post by caseih »

Glad you got it working. I don't completely understand what you were talking about with string length error.

Case sensitivity in the file system is something I really like, and I miss it in Windows, and on OS X I pretend that it is case sensitive. As for dealing with it, there are a number of ways that we use, some of which you mentioned:
- convention. Core system directories are always lower case. /etc, /usr. etc. In OS X, non-posix directories always seem to be like /Users, /Library, etc.
- always use relative paths. Calculate relative paths from the executable path, or have a number of well-defined locations to look for data such as /usr/share, /opt, $HOME/.config/, $HOME/.local/share, etc
- let the user specify locations (command line or GUI) and optionally store that location in a config file
- least recommended, always do a case insensitive search for a file name. This is very slow and cumbersome, and possibly error-prone, and could lead to security issues in some cases where a malicious user could create a file that shadows a file you are reading.
Last edited by caseih on Aug 05, 2015 1:48, edited 1 time in total.
Dinosaur
Posts: 1481
Joined: Jul 24, 2005 1:13
Location: Hervey Bay (.au)

Re: Library naming conventions in Linux

Post by Dinosaur »

Hi All

caseih said
I don't completely understand what you were talking about with string length error.
As part of a UDT I specified
Naam(0 To 31) As String * 7

When I tried to use that String, I expected it to be "Led0.bmp" , however it became "Led0###.bmp"
which of course could not be found.

Appreciate all your help.

Regards
caseih
Posts: 2157
Joined: Feb 26, 2007 5:32

Re: Library naming conventions in Linux

Post by caseih »

Oh okay I see that other thread now. Sounds like they'll have that bug fixed soon. I'm impressed with how fast FB devs fix bugs like that.
Post Reply