source: lumina/libLumina/LuminaOS-FreeBSD.cpp @ 49e615f

enter/10releng/10.0.3releng/10.1releng/10.1.1releng/10.1.2releng/10.2
Last change on this file since 49e615f was 49e615f, checked in by Ken Moore <ken@…>, 14 months ago

Add a new class to libLumina: LuminaOS (LOS:: internally). This class provides any OS-specific system calls, and can easily be used by different OS's simply by commenting out the LuminaOS-FreeBSD.cpp file from the project and inserting the appropraite LuminaOS-<OS>.cpp file instead. This means that the mainter of Lumina for a particular OS just needs to keep that one OS-specific file up to date.
I will be moving the rest of the OS-specific calls in lumina-desktop/Globals.h to this new location in the near future.

  • Property mode set to 100644
File size: 1.3 KB
Line 
1//===========================================
2//  Lumina-DE source code
3//  Copyright (c) 2013, Ken Moore
4//  Available under the 3-clause BSD license
5//  See the LICENSE file for full details
6//===========================================
7#include "LuminaOS.h"
8
9QStringList LOS::ExternalDevicePaths(){
10    //Returns: QStringList[<type>::::<filesystem>::::<path>]
11      //Note: <type> = [USB, HDRIVE, DVD, SDCARD, UNKNOWN]
12  QStringList devs = LUtils::getCmdOutput("mount");
13  //Now check the output
14  for(int i=0; i<devs.length(); i++){
15    if(devs[i].startsWith("/dev/")){
16      QString type = devs[i].section(" on ",0,0);
17        type.remove("/dev/");
18      //Determine the type of hardware device based on the dev node
19      if(type.startsWith("da")){ type = "USB"; }
20      else if(type.startsWith("ada")){ type = "HDRIVE"; }
21      else if(type.startsWith("mmsd")){ type = "SDCARD"; }
22      else if(type.startsWith("cd")||type.startsWith("acd")){ type="DVD"; }
23      else{ type = "UNKNOWN"; }
24      //Now put the device in the proper output format
25      devs[i] = type+"::::"+devs[i].section("(",1,1).section(",",0,0)+"::::"+devs[i].section(" on ",1,50).section("(",0,0).simplified();
26    }else{
27      //invalid device - remove it from the list
28      devs.removeAt(i);
29      i--;
30    }
31  }
32  return devs;
33}
Note: See TracBrowser for help on using the repository browser.