mirror of
https://github.com/dave-theunsub/clamtk.git
synced 2026-04-21 07:24:09 -04:00
86 lines
2.0 KiB
Perl
Executable File
86 lines
2.0 KiB
Perl
Executable File
#!/usr/bin/perl
|
|
#
|
|
# ClamTk, copyright (C) 2004-2016 Dave M
|
|
#
|
|
# This file is part of ClamTk.
|
|
# https://dave-theunsub.github.io/clamtk/
|
|
#
|
|
# ClamTk is free software; you can redistribute it and/or modify it
|
|
# under the terms of either:
|
|
#
|
|
# a) the GNU General Public License as published by the Free Software
|
|
# Foundation; either version 1, or (at your option) any later version, or
|
|
#
|
|
# b) the "Artistic License".
|
|
#
|
|
|
|
# use strict;
|
|
# use warnings;
|
|
use utf8;
|
|
$| = 1;
|
|
|
|
use ClamTk::Analysis;
|
|
use ClamTk::App;
|
|
use ClamTk::Assistant;
|
|
use ClamTk::GUI;
|
|
use ClamTk::History;
|
|
use ClamTk::Network;
|
|
use ClamTk::Prefs;
|
|
use ClamTk::Results;
|
|
use ClamTk::Scan;
|
|
use ClamTk::Schedule;
|
|
use ClamTk::Settings;
|
|
use ClamTk::Shortcuts;
|
|
use ClamTk::Startup;
|
|
use ClamTk::Update;
|
|
use ClamTk::Quarantine;
|
|
use ClamTk::Whitelist;
|
|
|
|
use Locale::gettext;
|
|
use POSIX 'locale_h';
|
|
textdomain( 'clamtk' );
|
|
setlocale( LC_ALL, '' );
|
|
bind_textdomain_codeset( 'clamtk', 'UTF-8' );
|
|
|
|
# Normally this would work...
|
|
# my $arg = $ARGV[0];
|
|
# print "argv = >$_<\n" for(@ARGV);
|
|
#
|
|
# Unfortunately, I don't know how to make python keep a
|
|
# URI with spaces intact. So....
|
|
my $arg = '';
|
|
$arg = join( ' ', @ARGV );
|
|
|
|
# Might be in the Trash
|
|
# // = entire directory
|
|
my $trash_dir = ClamTk::App->get_path( 'trash_dir' );
|
|
if ( $arg eq '//' ) {
|
|
# The whole "Trash" directory
|
|
$arg = $trash_dir;
|
|
} elsif ( $arg =~ m#^//(.*?)$# ) {
|
|
# individual file
|
|
my $trash_dir_files = ClamTk::App->get_path( 'trash_dir_files' );
|
|
if ( -e "$trash_dir_files/$1" ) {
|
|
$arg = "$trash_dir_files/$1";
|
|
}
|
|
}
|
|
|
|
# Ensure all the normal directories are created
|
|
ClamTk::Prefs->structure;
|
|
|
|
# Ensure the preferences are normalized
|
|
# Create defaults if they do not exist
|
|
ClamTk::Prefs->custom_prefs;
|
|
|
|
# If we get no arguments, bring up GUI;
|
|
# otherwise, we're scanning.
|
|
# Let Scanner know this is a commandline scan, so
|
|
# if we can't scan (e.g. due to permissions), exit
|
|
if ( !$arg or !-e $arg ) {
|
|
ClamTk::GUI->start_gui();
|
|
} else {
|
|
ClamTk::Scan->filter( $arg, 1, 'startup' );
|
|
}
|
|
|
|
# End.
|