mirror of
https://github.com/Sude-/lgogdownloader.git
synced 2025-02-02 05:52:31 +01:00
Merge branch 'detectTerminal' of https://github.com/chanceVermilion/lgogdownloader
This commit is contained in:
commit
f93c8ee753
13
src/util.cpp
13
src/util.cpp
@ -379,9 +379,16 @@ void Util::setFilePermissions(const boost::filesystem::path& path, const boost::
|
|||||||
|
|
||||||
int Util::getTerminalWidth()
|
int Util::getTerminalWidth()
|
||||||
{
|
{
|
||||||
struct winsize w;
|
int width;
|
||||||
ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);
|
if(isatty(STDOUT_FILENO))
|
||||||
return static_cast<int>(w.ws_col);
|
{
|
||||||
|
struct winsize w;
|
||||||
|
ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);
|
||||||
|
width = static_cast<int>(w.ws_col);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
width = 10000;//Something sufficiently big
|
||||||
|
return width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user