<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      秋·風

        博客園 :: 首頁 :: 博問 :: 閃存 :: 新隨筆 :: 聯系 :: 訂閱 訂閱 :: 管理 ::

      為lazarus生成的linux程序提供相關的快捷訪問方式,參考fpcupdeluxe源碼,編寫了一個通用的CreateDesktopShortCut,只要調用CreateDesktopShortCut就可以生成相應的快捷方式及文件關聯。
      注意:文件關聯時的圖標用png格式

      開始菜單程序名稱存放路徑:
      /home/用戶名/.local/share/applications

      文件關聯放以下2個路徑:
      /home/用戶名/.local/share/mime/application
      /home/用戶名/.local/share/mime/packages 

      桌面快捷方式存放路徑:
      /home/用戶名/桌面

      unit Unit1;
      
      {$mode objfpc}{$H+}
      
      interface
      
      uses
        Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, Buttons,
        IniFiles, BaseUnix, FileUtil, process
      ;
      
      type
      
        { TForm1 }
      
        TForm1 = class(TForm)
          Button1: TButton;
          Edit1: TEdit;
          Edit2: TEdit;
          Edit3: TEdit;
          Edit5: TEdit;
          Edit7: TEdit;
          Edit6: TEdit;
          Label1: TLabel;
          Label2: TLabel;
          Label3: TLabel;
          Label4: TLabel;
          Label5: TLabel;
          Label6: TLabel;
          OpenDialog1: TOpenDialog;
          SpeedButton1: TSpeedButton;
          SpeedButton2: TSpeedButton;
          procedure Button1Click(Sender: TObject);
          procedure SpeedButton1Click(Sender: TObject);
          procedure SpeedButton2Click(Sender: TObject);
        private
      
        public
      
        end;
      
      var
        Form1: TForm1;
      
      implementation
      
      {$R *.lfm}
      
      { TForm1 }
      
      function ForceDirectoriesSafe(Const Dir: RawByteString): Boolean;
      var
        aDir:RawByteString;
      begin
        result:=true;
        if (Length(Dir)=0) then exit;
        aDir:=ExcludeTrailingPathDelimiter(Dir);
        if (Length(aDir)=0) then exit;
        if (NOT DirectoryExists(aDir)) then
          result:=ForceDirectories(aDir);
      end;
      
      procedure CreateDesktopShortCut(Target,Execs,icons,filetypes,FileExt, ShortcutName: string);
      var
        OperationSucceeded: boolean;
        ResultCode: boolean;
        XdgDesktopContent: TStringList;
        XdgMimeContent: TStringList;
        Output,XdgDesktopFile,XdgMimeFile: string;
        aDirectory:string;
        i,j:integer;
        AddContext:boolean;
        ft:TStrings;
      begin
        ft:=TStringList.Create;
        ft.Delimiter:=';';
        ft.DelimitedText:=FileExt;
        j:=ft.Count;
        if (j>0) and (filetypes<>'') then AddContext:=true
        ELSE addcontext:=false;
      
        // Fail by default:
        OperationSucceeded:=false;
      
        XdgDesktopFile:=IncludeTrailingPathDelimiter(GetTempDir(false))+shortcutname+'.desktop';
        XdgDesktopContent:=TStringList.Create;
        try
          XdgDesktopContent.Add('[Desktop Entry]');
          XdgDesktopContent.Add('Version=1.0');
          XdgDesktopContent.Add('Encoding=UTF-8');
          XdgDesktopContent.Add('Type=Application');
          XdgDesktopContent.Add('Icon='+icons);
          XdgDesktopContent.Add('Exec='+execs+' %u');
          XdgDesktopContent.Add('Name='+ShortcutName);
          XdgDesktopContent.Add('Category=Application;');
          XdgDesktopContent.Add('Categories=Application;Programming;');
      
          if AddContext then
          begin
            XdgDesktopContent.Add('MimeType=application/x-'+filetypes+';');
          end;
      
          try
            XdgDesktopContent.SaveToFile(XdgDesktopFile);
            FpChmod(XdgDesktopFile, &711); //rwx--x--x
            OperationSucceeded:=RunCommand('xdg-desktop-icon' ,['install','--novendor',XdgDesktopFile],Output,[poUsePipes, poStderrToOutPut]{$IF DEFINED(FPC_FULLVERSION) AND (FPC_FULLVERSION >= 30200)},swoHide{$ENDIF});
            OperationSucceeded:=RunCommand('xdg-desktop-menu' ,['install','--novendor',XdgDesktopFile],Output,[poUsePipes, poStderrToOutPut]{$IF DEFINED(FPC_FULLVERSION) AND (FPC_FULLVERSION >= 30200)},swoHide{$ENDIF});
          except
            OperationSucceeded:=false;
          end;
      
          if (true) then
          begin
            aDirectory:=ConcatPaths(['usr','share','applications']);
            if ( (FpGeteuid=0) AND DirectoryExists(aDirectory) ) then
            begin
              FileUtil.CopyFile(XdgDesktopFile,aDirectory+DirectorySeparator+ExtractFileName(XdgDesktopFile),[]);
            end
            else
            begin
              // Create shortcut directly on User-Desktop
              aDirectory:=ConcatPaths([GetUserDir,'Desktop']);
              if DirectoryExists(aDirectory) then
                 FileUtil.CopyFile(XdgDesktopFile,aDirectory+DirectorySeparator+ExtractFileName(XdgDesktopFile),[]);
              // Create user menu item
              if (NOT OperationSucceeded) then
              begin
                aDirectory:=ConcatPaths([GetUserDir,'.local','share','applications']);
                if DirectoryExists(aDirectory) then
                  FileUtil.CopyFile(XdgDesktopFile,aDirectory+DirectorySeparator+ExtractFileName(XdgDesktopFile),[]);
              end;
            end;
          end;
          // Temp file is no longer needed....
          try
            SysUtils.DeleteFile(XdgDesktopFile);
          finally
            // Swallow, let filesystem maintenance clear it up
          end;
        finally
          XdgDesktopContent.Free;
          OperationSucceeded:=true;
        end;
      
        if (OperationSucceeded) then
        begin
          aDirectory:=ConcatPaths([GetUserDir,'.local','share','applications']);
          OperationSucceeded:=RunCommand('update-desktop-database' ,[aDirectory],Output,[poUsePipes, poStderrToOutPut]{$IF DEFINED(FPC_FULLVERSION) AND (FPC_FULLVERSION >= 30200)},swoHide{$ENDIF});
        end;
        if AddContext then
        begin
          {$ifdef LCL}
          Application.ProcessMessages;
          {$endif}
      
          aDirectory:=ConcatPaths([GetUserDir,'.local','share','mime']);
          ForceDirectoriesSafe(aDirectory);
      
          //Create mime file associations
          XdgMimeFile:=IncludeTrailingPathDelimiter(GetTempDir(false))+shortcutname+'.xml';
          XdgMimeContent:=TStringList.Create;
          try
            XdgMimeContent.Add('<?xml version="1.0" encoding="UTF-8"?>');
            XdgMimeContent.Add('<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">');
            XdgMimeContent.Add('    <mime-type type="application/x-'+filetypes+'">');
            XdgMimeContent.Add('        <comment>TEXT file</comment>');
            XdgMimeContent.Add('        <icon name="application-x-'+filetypes+'"/>');
            XdgMimeContent.Add('        <glob-deleteall/>');
            for i:=0 to j-1 do
            begin
              XdgMimeContent.Add('        <glob pattern="'+ft[i]+'"/>');
            end;
            XdgMimeContent.Add('    </mime-type>');
            XdgMimeContent.Add('</mime-info>');
            aDirectory:=ConcatPaths([GetUserDir,'.local','share','mime','packages']);
            ForceDirectoriesSafe(aDirectory);
            XdgMimeContent.SaveToFile(XdgMimeFile);
            OperationSucceeded:=RunCommand('xdg-mime' ,['install','--novendor',XdgMimeFile],Output,[poUsePipes, poStderrToOutPut]{$IF DEFINED(FPC_FULLVERSION) AND (FPC_FULLVERSION >= 30200)},swoHide{$ENDIF});
            SysUtils.DeleteFile(XdgMimeFile);
          finally
            XdgMimeContent.Free;
          end;
      
          //Process icon
          aDirectory:=ConcatPaths([GetUserDir,'.local','share','icons']);
          ForceDirectoriesSafe(aDirectory);
          OperationSucceeded:=RunCommand('xdg-icon-resource' ,['install','--novendor',
          '--context','mimetypes','--size','64',icons,'application-x-'+filetypes+''],Output,
          [poUsePipes, poStderrToOutPut]{$IF DEFINED(FPC_FULLVERSION) AND (FPC_FULLVERSION >= 30200)},swoHide{$ENDIF});
      
          //Update mime database
          aDirectory:=ConcatPaths([GetUserDir,'.local','share','mime']);
          OperationSucceeded:=RunCommand('update-mime-database' ,[aDirectory],Output,
          [poUsePipes, poStderrToOutPut]{$IF DEFINED(FPC_FULLVERSION) AND (FPC_FULLVERSION >= 30200)},swoHide{$ENDIF});
        end;
        ft.free;
      
      end;
      
      
      procedure TForm1.Button1Click(Sender: TObject);
      var aDirectory,vFileName,Output,deskname:String;
      begin
        deskname:=edit1.Text;
        aDirectory := ConcatPaths([GetUserDir, '桌面']);
        if not DirectoryExists(aDirectory) then
            aDirectory := ConcatPaths([GetUserDir, 'Desktop']);
        CreateDesktopShortCut(aDirectory,edit2.text,edit5.text,Edit6.text,Edit7.text,deskname);
      end;
      
      procedure TForm1.SpeedButton1Click(Sender: TObject);
      begin
        if opendialog1.Execute then
        Begin
           edit2.Text:= opendialog1.FileName;
           edit1.Text:=ExtractFileName(edit2.Text);
        end;
      end;
      
      procedure TForm1.SpeedButton2Click(Sender: TObject);
      begin
        if opendialog1.Execute then
        Begin
           edit5.Text:= opendialog1.FileName;
        end;
      
      end;
      
      end.



       

      posted on 2022-06-28 07:26  秋·風  閱讀(786)  評論(0)    收藏  舉報
      主站蜘蛛池模板: 一本色道婷婷久久欧美| 在线免费播放av观看| 亚洲精品一区二区三区婷婷月| 毛片在线看免费| 亚洲中文字幕在线无码一区二区| 亚洲国产另类久久久精品小说| 一区二区亚洲人妻av| 中文字幕日韩有码一区| 爱性久久久久久久久| 日本深夜福利在线观看| 成人无码视频97免费| 亚洲色偷偷偷网站色偷一区| 国产精品无码不卡在线播放| 国产 一区二区三区视频| 晋城| 久久道精品一区二区三区| 亚洲欧美日韩愉拍自拍美利坚| 国产欧美在线一区二区三| 年日韩激情国产自偷亚洲| 亚洲高清aⅴ日本欧美视频| 国产精品亚洲mnbav网站| av在线中文字幕不卡电影网| 蜜桃一区二区三区在线看| 加勒比中文字幕无码一区| 九九热视频在线观看精品| 成人乱码一区二区三区四区| 欧美成人午夜在线观看视频| 成人aⅴ综合视频国产| 亚洲人成网站18禁止无码| 天堂中文8资源在线8| 精品在免费线中文字幕久久| 自拍亚洲综合在线精品| 中文字幕无码乱码人妻系列蜜桃| 国产成人午夜精品永久免费| 久热伊人精品国产中文| 国产精品日韩中文字幕| 久久亚洲人成网站| 亚洲av无码乱码在线观看牲色| 成人爽a毛片免费| 国产精品久久久久aaaa| 黄色三级亚洲男人的天堂|