Forum > Other OS

FileExistUTF8 problem

<< < (2/3) > >>

BeanzMaster:
If i do
--- Code: Pascal  window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---ExtractFilePath(Application.ExeName) it return

"/Users/usename/Documents/Projets/Lazarus/Components/GIFViewer/demos/gifview.app/Contents/MacOS/"

if i do
--- Code: Pascal  window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---getCurrentDir it returns "/"

So what's the trick under MacOS ?

GetMem:

--- Quote ---It is the demo gifviewer is trandlated to english or french when you change language ?

--- End quote ---
I did not test with gifviewer, just with a regular file. 


--- Quote ---If i do  ExtractFilePath(Application.ExeName) it returns:
"/Users/usename/Documents/Projets/Lazarus/Components/GIFViewer/demos/gifview.app/Contents/MacOS/"

--- End quote ---
Yes because gifview.app(bundle) is basically a directory. When you're done with the development, you should copy the executable "gifview"(located in your main development folder) into the bundle("gifview.app/Contents/MacOS/") and replace the symlink with the executable. You can achieve this by right clicking gifview.app then "Show Package Contents". It's common practice(OSX) to keep the resources(images, language files, etc) inside the bundle, however if you wish a solution which will work on every major platform you can do something like this:

--- Code: Pascal  window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---var  PathToLangFiles: String;begin  {$IFDEF LCLcarbon}    PathToLangFiles := Copy(Application.ExeName, 1, Pos(ApplicationName + '.app', Application.ExeName) - 1) + PathDelim + 'languages';  {$ELSE}    PathToLangFiles := Application.ExeName + PathDelim + 'languages';  {$ENDIF}           end;        
The above code will return the languages directory located in the main development folder, beside the executable(bundle on osx).

BeanzMaster:

--- Quote from: GetMem on June 30, 2018, 11:02:36 am ---
--- Quote ---It is the demo gifviewer is trandlated to english or french when you change language ?

--- End quote ---
I did not test with gifviewer, just with a regular file. 


--- Quote ---If i do  ExtractFilePath(Application.ExeName) it returns:
"/Users/usename/Documents/Projets/Lazarus/Components/GIFViewer/demos/gifview.app/Contents/MacOS/"

--- End quote ---
Yes because gifview.app(bundle) is basically a directory. When you're done with the development, you should copy the executable "gifview"(located in your main development folder) into the bundle("gifview.app/Contents/MacOS/") and replace the symlink with the executable. You can achieve this by right clicking gifview.app then "Show Package Contents". It's common practice(OSX) to keep the resources(images, language files, etc) inside the bundle, however if you wish a solution which will work on every major platform you can do something like this:

--- Code: Pascal  window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---var  PathToLangFiles: String;begin  {$IFDEF LCLcarbon}    PathToLangFiles := Copy(Application.ExeName, 1, Pos(ApplicationName + '.app', Application.ExeName) - 1) + PathDelim + 'languages';  {$ELSE}    PathToLangFiles := Application.ExeName + PathDelim + 'languages';  {$ENDIF}           end;        
The above code will return the languages directory located in the main development folder, beside the executable(bundle on osx).

--- End quote ---

Thanks GetMem. Yesterday i see, i enable the gdb output. This is because i've  enabled "Include Application Informations" in the project's option.
I had also some problem with GDB and this project du to the symlinks  and by disable it all gone to the normal.

I'll test your piece of code

Thanks

Cheers

BeanzMaster:
Thanks Getmem it solve the path problem, but ui is never translated  :o

GetMem:

--- Quote ---Thanks Getmem it solve the path problem, but ui is never translated  :o
--- End quote ---
You're welcome. Did you try to debug it? Unfortunately the debugger is not working properly on my OSX.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version