Start updating file header comments to standardized new format
This commit is contained in:
parent
1ca946f3eb
commit
f38b7485f7
33 changed files with 357 additions and 241 deletions
|
|
@ -1,17 +1,20 @@
|
|||
#include "AutoStart-FreeBSD.h"
|
||||
#include "LogManager.h"
|
||||
#include "filesystem.h"
|
||||
/*---------------------------------------------------------*\
|
||||
| AutoStart-FreeBSD.cpp |
|
||||
| |
|
||||
| Autostart implementation for FreeBSD |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <limits.h>
|
||||
#include <unistd.h>
|
||||
#include <sstream>
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| FreeBSD AutoStart Implementation |
|
||||
| Public Methods |
|
||||
\*-----------------------------------------------------*/
|
||||
#include "AutoStart-FreeBSD.h"
|
||||
#include "LogManager.h"
|
||||
#include "filesystem.h"
|
||||
|
||||
AutoStart::AutoStart(std::string name)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,3 +1,12 @@
|
|||
/*---------------------------------------------------------*\
|
||||
| AutoStart-FreeBSD.h |
|
||||
| |
|
||||
| Autostart implementation for FreeBSD |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
|
|
|||
|
|
@ -1,17 +1,20 @@
|
|||
#include "AutoStart-Linux.h"
|
||||
#include "LogManager.h"
|
||||
#include "filesystem.h"
|
||||
/*---------------------------------------------------------*\
|
||||
| AutoStart-Linux.cpp |
|
||||
| |
|
||||
| Autostart implementation for Linux |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <unistd.h>
|
||||
#include <linux/limits.h>
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Linux AutoStart Implementation |
|
||||
| Public Methods |
|
||||
\*-----------------------------------------------------*/
|
||||
#include "AutoStart-Linux.h"
|
||||
#include "LogManager.h"
|
||||
#include "filesystem.h"
|
||||
|
||||
AutoStart::AutoStart(std::string name)
|
||||
{
|
||||
|
|
@ -122,7 +125,7 @@ std::string AutoStart::GetExePath()
|
|||
char exepath[ PATH_MAX ];
|
||||
|
||||
ssize_t count = readlink("/proc/self/exe", exepath, PATH_MAX);
|
||||
|
||||
|
||||
return(std::string(exepath, (count > 0) ? count : 0));
|
||||
}
|
||||
|
||||
|
|
@ -159,7 +162,7 @@ std::string AutoStart::GenerateDesktopFile(AutoStartInfo autostart_info)
|
|||
}
|
||||
|
||||
fileContents << std::endl;
|
||||
|
||||
|
||||
return(fileContents.str());
|
||||
}
|
||||
|
||||
|
|
@ -198,7 +201,7 @@ void AutoStart::InitAutoStart(std::string name)
|
|||
std::error_code ec;
|
||||
|
||||
bool success = true;
|
||||
|
||||
|
||||
if(!filesystem::exists(autostart_dir))
|
||||
{
|
||||
success = filesystem::create_directories(autostart_dir, ec);
|
||||
|
|
|
|||
|
|
@ -1,3 +1,12 @@
|
|||
/*---------------------------------------------------------*\
|
||||
| AutoStart-Linux.h |
|
||||
| |
|
||||
| Autostart implementation for Linux |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
|
|
|||
|
|
@ -1,18 +1,20 @@
|
|||
#include "AutoStart-MacOS.h"
|
||||
#include "LogManager.h"
|
||||
#include "filesystem.h"
|
||||
/*---------------------------------------------------------*\
|
||||
| AutoStart-MacOS.cpp |
|
||||
| |
|
||||
| Autostart implementation for MacOS |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <mach-o/dyld.h>
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| MacOS AutoStart Implementation |
|
||||
| Public Methods |
|
||||
\*-----------------------------------------------------*/
|
||||
#include "AutoStart-MacOS.h"
|
||||
#include "LogManager.h"
|
||||
#include "filesystem.h"
|
||||
|
||||
AutoStart::AutoStart(std::string name)
|
||||
{
|
||||
|
|
@ -152,7 +154,7 @@ std::string AutoStart::GenerateLaunchAgentFile(AutoStartInfo autostart_info)
|
|||
fileContents << " <key>ProgramArguments</key>" << std::endl;
|
||||
fileContents << " <array>" << std::endl;
|
||||
fileContents << " <string>" << autostart_info.path << "</string>" << std::endl;
|
||||
|
||||
|
||||
if(autostart_info.args != "")
|
||||
{
|
||||
std::istringstream arg_parser(autostart_info.args);
|
||||
|
|
@ -163,12 +165,12 @@ std::string AutoStart::GenerateLaunchAgentFile(AutoStartInfo autostart_info)
|
|||
fileContents << " <string>" << arg << "</string>" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fileContents << " </array>" << std::endl;
|
||||
fileContents << " <key>RunAtLoad</key><true/>" << std::endl;
|
||||
fileContents << "</dict>" << std::endl;
|
||||
fileContents << "</plist>" << std::endl;
|
||||
|
||||
|
||||
return(fileContents.str());
|
||||
}
|
||||
|
||||
|
|
@ -193,7 +195,7 @@ void AutoStart::InitAutoStart(std::string name)
|
|||
std::error_code ec;
|
||||
|
||||
bool success = true;
|
||||
|
||||
|
||||
if(!filesystem::exists(autostart_dir))
|
||||
{
|
||||
success = filesystem::create_directories(autostart_dir, ec);
|
||||
|
|
|
|||
|
|
@ -1,3 +1,12 @@
|
|||
/*---------------------------------------------------------*\
|
||||
| AutoStart-MacOS.h |
|
||||
| |
|
||||
| Autostart implementation for MacOS |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
|
|
|||
|
|
@ -1,17 +1,19 @@
|
|||
#include "AutoStart-Windows.h"
|
||||
#include "LogManager.h"
|
||||
#include "filesystem.h"
|
||||
/*---------------------------------------------------------*\
|
||||
| AutoStart-Windows.cpp |
|
||||
| |
|
||||
| Autostart implementation for Windows |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
#include "windows.h"
|
||||
#include <shlobj.h>
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Windows AutoStart Implementation |
|
||||
| Public Methods |
|
||||
\*-----------------------------------------------------*/
|
||||
#include "AutoStart-Windows.h"
|
||||
#include "LogManager.h"
|
||||
#include "filesystem.h"
|
||||
#include "windows.h"
|
||||
|
||||
AutoStart::AutoStart(std::string name)
|
||||
{
|
||||
|
|
@ -41,7 +43,7 @@ bool AutoStart::DisableAutoStart()
|
|||
else
|
||||
{
|
||||
success = filesystem::remove(autostart_file, autostart_file_remove_errcode);
|
||||
|
||||
|
||||
if(!success)
|
||||
{
|
||||
LOG_ERROR("An error occurred removing the auto start file.");
|
||||
|
|
@ -97,11 +99,11 @@ bool AutoStart::EnableAutoStart(AutoStartInfo autostart_info)
|
|||
shellLink->SetArguments(argumentsw.c_str());
|
||||
shellLink->SetDescription(descriptionw.c_str());
|
||||
shellLink->SetIconLocation(iconw.c_str(), 0);
|
||||
|
||||
|
||||
IPersistFile* persistFile;
|
||||
|
||||
|
||||
result = shellLink->QueryInterface(IID_IPersistFile, (void**)&persistFile);
|
||||
|
||||
|
||||
if(SUCCEEDED(result))
|
||||
{
|
||||
result = persistFile->Save(startupfilepathw.c_str(), TRUE);
|
||||
|
|
@ -151,7 +153,7 @@ std::string AutoStart::GetExePath()
|
|||
char exepath[MAX_PATH] = "";
|
||||
|
||||
DWORD count = GetModuleFileNameA(NULL, exepath, MAX_PATH);
|
||||
|
||||
|
||||
return(std::string(exepath, (count > 0) ? count : 0));
|
||||
}
|
||||
|
||||
|
|
@ -197,8 +199,8 @@ std::wstring AutoStart::utf8_decode(const std::string& str)
|
|||
int size_needed = MultiByteToWideChar(CP_UTF8, 0, &str[0], (int) str.size(), nullptr, 0);
|
||||
|
||||
std::wstring wstrTo(size_needed, 0);
|
||||
|
||||
|
||||
MultiByteToWideChar(CP_UTF8, 0, &str[0], (int) str.size(), &wstrTo[0], size_needed);
|
||||
|
||||
|
||||
return(wstrTo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,12 @@
|
|||
/*---------------------------------------------------------*\
|
||||
| AutoStart-Windows.h |
|
||||
| |
|
||||
| Autostart implementation for Windows |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
|
|
|||
|
|
@ -1,9 +1,13 @@
|
|||
#include "AutoStart.h"
|
||||
/*---------------------------------------------------------*\
|
||||
| AutoStart.cpp |
|
||||
| |
|
||||
| Autostart common implementation |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Common AutoStart Implementation |
|
||||
| Public Methods |
|
||||
\*-----------------------------------------------------*/
|
||||
#include "AutoStart.h"
|
||||
|
||||
std::string AutoStartInterface::GetAutoStartFile()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,3 +1,12 @@
|
|||
/*---------------------------------------------------------*\
|
||||
| AutoStart.h |
|
||||
| |
|
||||
| Autostart common implementation |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue