// File: metopa[P]HTTP_Server/src/content/CDirContent.cpp
// Function: CDirContent::load()
void CDirContent::load() {
	int rc;
	DIR * dir;
	dirent entry;
	dirent * result;
	Log.ger<>( DEBUG_REQUEST, "Directory:", realPath_m, userPath_m );
	vector<CHTMLGenerator> files_m;

	if ( !( dir = opendir( realPath_m.c_str() ) ) ) {
		int errNo = errno;

		switch ( errNo ) {
			case EACCES:
				throw PermissionDeniedException( userPath_m );
			case ENOENT:
				throw FileNotFoundException( userPath_m );
			default:
				throw FileErrorException( userPath_m );
		}
	}

	while ( !( rc = readdir_r( dir, &entry, &result ) ) ) {
		if ( result == nullptr )
			break;
		files_m.push_back( CHTMLGenerator( result->d_name ) );
		Log.ger<>( DEBUG_REQUEST, "Directory", result->d_name, (int)result->d_type );
		if ( result->d_type == DT_DIR || result->d_type == DT_REG )
			files_m.back().makeHyperlink( makeLink( result->d_name ) );
		files_m.back().enlarge();
		if ( !strcmp( result->d_name, ".." ) )
			files_m.back().setPriority( -2 );
		else if ( !strcmp( result->d_name, "." ) )
			files_m.back().setPriority( -1 );
	}

	stable_sort( files_m.begin(), files_m.end() );

	CHTMLGenerator table( string( "Index of " ) + userPath_m );
	table.enlarge( 2 ).makeTable( files_m );
	if ( rc )
		table.append( "\nAn error occured while reading directory content. Try to refresh page\n" );
	string rawHTML = table.wrap( string( "Index of " ) + userPath_m.c_str() );
	data_m.insert( data_m.begin(), rawHTML.begin(), rawHTML.end() );

	closedir( dir );

	size_m = data_m.size();

	modificationTime();
	creationTime();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x3e0, %rsp            # imm = 0x3E0
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %r8
movq %r8, -0x348(%rbp)
movq %r8, %rcx
addq $0x40, %rcx
movq %rcx, -0x340(%rbp)
addq $0x20, %r8
leaq 0x299fd(%rip), %rdi     # 0x3f6e0
leaq 0x166e4(%rip), %rdx     # 0x2c3ce
movl $0x7, %esi
callq 0x16800
leaq -0x150(%rbp), %rdi
callq 0x168d0
movq -0x340(%rbp), %rdi
callq 0x6240
movq %rax, %rdi
callq 0x67e0
movq %rax, -0x338(%rbp)
jmp 0x15d1d
movq -0x338(%rbp), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
jne 0x15ebe
callq 0x6080
movl (%rax), %eax
movl %eax, -0x160(%rbp)
movl -0x160(%rbp), %eax
movl %eax, -0x34c(%rbp)
subl $0x2, %eax
je 0x15de8
jmp 0x15d56
movl -0x34c(%rbp), %eax
subl $0xd, %eax
je 0x15d7d
jmp 0x15e53
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x158(%rbp)
movl %eax, -0x15c(%rbp)
jmp 0x1663d
movl $0x48, %edi
callq 0x6280
movq -0x348(%rbp), %rsi
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x358(%rbp)
addq $0x20, %rsi
callq 0x168f0
jmp 0x15da6
movq -0x358(%rbp), %rdi
leaq 0x28844(%rip), %rsi     # 0x3e5f8
leaq 0xb75(%rip), %rdx       # 0x16930
callq 0x68e0
jmp 0x16655
movq -0x358(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x158(%rbp)
movl %eax, -0x15c(%rbp)
callq 0x63b0
jmp 0x1663d
movl $0x48, %edi
callq 0x6280
movq -0x348(%rbp), %rsi
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x360(%rbp)
addq $0x20, %rsi
callq 0x16950
jmp 0x15e11
movq -0x360(%rbp), %rdi
leaq 0x285b1(%rip), %rsi     # 0x3e3d0
leaq -0xb356(%rip), %rdx     # 0xaad0
callq 0x68e0
jmp 0x16655
movq -0x360(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x158(%rbp)
movl %eax, -0x15c(%rbp)
callq 0x63b0
jmp 0x1663d
movl $0x48, %edi
callq 0x6280
movq -0x348(%rbp), %rsi
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x368(%rbp)
addq $0x20, %rsi
callq 0x16a10
jmp 0x15e7c
movq -0x368(%rbp), %rdi
leaq 0x28786(%rip), %rsi     # 0x3e610
leaq 0xbbf(%rip), %rdx       # 0x16a50
callq 0x68e0
jmp 0x16655
movq -0x368(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x158(%rbp)
movl %eax, -0x15c(%rbp)
callq 0x63b0
jmp 0x1663d
jmp 0x15ec0
movq -0x18(%rbp), %rdi
leaq -0x130(%rbp), %rsi
leaq -0x138(%rbp), %rdx
callq 0x6200
movl %eax, -0x36c(%rbp)
jmp 0x15edf
movl -0x36c(%rbp), %eax
movl %eax, -0xc(%rbp)
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x15ef9
jmp 0x161fb
cmpq $0x0, -0x138(%rbp)
jne 0x15f08
jmp 0x161fb
movq -0x138(%rbp), %rax
addq $0x13, %rax
movq %rax, -0x380(%rbp)
leaq -0x1a9(%rbp), %rdi
movq %rdi, -0x378(%rbp)
callq 0x6930
movq -0x380(%rbp), %rsi
movq -0x378(%rbp), %rdx
leaq -0x1a8(%rbp), %rdi
callq 0xa9d0
jmp 0x15f49
leaq -0x188(%rbp), %rdi
leaq -0x1a8(%rbp), %rsi
xorl %edx, %edx
callq 0x1df60
jmp 0x15f60
leaq -0x150(%rbp), %rdi
leaq -0x188(%rbp), %rsi
callq 0x16a70
jmp 0x15f75
leaq -0x188(%rbp), %rdi
callq 0x16aa0
leaq -0x1a8(%rbp), %rdi
callq 0x6310
leaq -0x1a9(%rbp), %rdi
callq 0x6550
movq -0x138(%rbp), %rax
movq %rax, %rcx
addq $0x13, %rcx
movzbl 0x12(%rax), %eax
movl %eax, -0x1b0(%rbp)
leaq 0x29728(%rip), %rdi     # 0x3f6e0
leaq 0x1641a(%rip), %rdx     # 0x2c3d9
movl $0x7, %esi
leaq -0x1b0(%rbp), %r8
callq 0x16ac0
jmp 0x15fd2
movq -0x138(%rbp), %rax
movzbl 0x12(%rax), %eax
cmpl $0x4, %eax
je 0x15ff6
movq -0x138(%rbp), %rax
movzbl 0x12(%rax), %eax
cmpl $0x8, %eax
jne 0x1616a
leaq -0x150(%rbp), %rdi
callq 0x16b90
movq %rax, -0x398(%rbp)
movq -0x138(%rbp), %rax
addq $0x13, %rax
movq %rax, -0x390(%rbp)
leaq -0x1f1(%rbp), %rdi
movq %rdi, -0x388(%rbp)
callq 0x6930
movq -0x390(%rbp), %rsi
movq -0x388(%rbp), %rdx
leaq -0x1f0(%rbp), %rdi
callq 0xa9d0
jmp 0x1604a
movq -0x348(%rbp), %rsi
leaq -0x1d0(%rbp), %rdi
leaq -0x1f0(%rbp), %rdx
callq 0x16660
jmp 0x16066
movq -0x398(%rbp), %rdi
leaq -0x1d0(%rbp), %rsi
callq 0x1e4c0
jmp 0x1607b
leaq -0x1d0(%rbp), %rdi
callq 0x6310
leaq -0x1f0(%rbp), %rdi
callq 0x6310
leaq -0x1f1(%rbp), %rdi
callq 0x6550
jmp 0x1616a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x158(%rbp)
movl %eax, -0x15c(%rbp)
jmp 0x160f6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x158(%rbp)
movl %eax, -0x15c(%rbp)
jmp 0x160ea
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x158(%rbp)
movl %eax, -0x15c(%rbp)
leaq -0x188(%rbp), %rdi
callq 0x16aa0
leaq -0x1a8(%rbp), %rdi
callq 0x6310
leaq -0x1a9(%rbp), %rdi
callq 0x6550
jmp 0x1663d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x158(%rbp)
movl %eax, -0x15c(%rbp)
jmp 0x16159
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x158(%rbp)
movl %eax, -0x15c(%rbp)
jmp 0x1614d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x158(%rbp)
movl %eax, -0x15c(%rbp)
leaq -0x1d0(%rbp), %rdi
callq 0x6310
leaq -0x1f0(%rbp), %rdi
callq 0x6310
leaq -0x1f1(%rbp), %rdi
callq 0x6550
jmp 0x1663d
leaq -0x150(%rbp), %rdi
callq 0x16b90
movq %rax, %rdi
xorl %esi, %esi
callq 0x1e950
jmp 0x16182
movq -0x138(%rbp), %rdi
addq $0x13, %rdi
leaq 0x164f6(%rip), %rsi     # 0x2c68a
callq 0x6760
cmpl $0x0, %eax
jne 0x161bb
leaq -0x150(%rbp), %rdi
callq 0x16b90
movq %rax, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x1ecd0
jmp 0x161b9
jmp 0x161f6
movq -0x138(%rbp), %rdi
addq $0x13, %rdi
leaq 0x164be(%rip), %rsi     # 0x2c68b
callq 0x6760
cmpl $0x0, %eax
jne 0x161f4
leaq -0x150(%rbp), %rdi
callq 0x16b90
movq %rax, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x1ecd0
jmp 0x161f2
jmp 0x161f4
jmp 0x161f6
jmp 0x15ec0
leaq -0x150(%rbp), %rdi
movq %rdi, -0x3a0(%rbp)
callq 0x16c10
movq -0x3a0(%rbp), %rdi
movq %rax, -0x200(%rbp)
callq 0x16c40
movq %rax, -0x208(%rbp)
movq -0x200(%rbp), %rdi
movq -0x208(%rbp), %rsi
callq 0x16bd0
jmp 0x1623d
leaq -0x271(%rbp), %rdi
movq %rdi, -0x3a8(%rbp)
callq 0x6930
movq -0x3a8(%rbp), %rdx
leaq 0x16185(%rip), %rsi     # 0x2c3e3
leaq -0x270(%rbp), %rdi
callq 0xa9d0
jmp 0x1626c
movq -0x348(%rbp), %rdx
addq $0x20, %rdx
leaq -0x250(%rbp), %rdi
leaq -0x270(%rbp), %rsi
callq 0x16c70
jmp 0x1628c
leaq -0x230(%rbp), %rdi
leaq -0x250(%rbp), %rsi
xorl %edx, %edx
callq 0x1df60
jmp 0x162a3
leaq -0x250(%rbp), %rdi
callq 0x6310
leaq -0x270(%rbp), %rdi
callq 0x6310
leaq -0x271(%rbp), %rdi
callq 0x6550
leaq -0x230(%rbp), %rdi
movl $0x2, %esi
callq 0x1e950
movq %rax, -0x3b0(%rbp)
jmp 0x162e1
movq -0x3b0(%rbp), %rdi
leaq -0x150(%rbp), %rsi
callq 0x1e5f0
jmp 0x162f6
cmpl $0x0, -0xc(%rbp)
je 0x1641e
leaq -0x299(%rbp), %rdi
movq %rdi, -0x3b8(%rbp)
callq 0x6930
movq -0x3b8(%rbp), %rdx
leaq 0x160cc(%rip), %rsi     # 0x2c3ed
leaq -0x298(%rbp), %rdi
callq 0xa9d0
jmp 0x1632f
leaq -0x230(%rbp), %rdi
leaq -0x298(%rbp), %rsi
callq 0x1e460
jmp 0x16344
leaq -0x298(%rbp), %rdi
callq 0x6310
leaq -0x299(%rbp), %rdi
callq 0x6550
jmp 0x1641e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x158(%rbp)
movl %eax, -0x15c(%rbp)
jmp 0x163b3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x158(%rbp)
movl %eax, -0x15c(%rbp)
jmp 0x163a7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x158(%rbp)
movl %eax, -0x15c(%rbp)
leaq -0x250(%rbp), %rdi
callq 0x6310
leaq -0x270(%rbp), %rdi
callq 0x6310
leaq -0x271(%rbp), %rdi
callq 0x6550
jmp 0x1663d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x158(%rbp)
movl %eax, -0x15c(%rbp)
jmp 0x16631
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x158(%rbp)
movl %eax, -0x15c(%rbp)
jmp 0x1640d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x158(%rbp)
movl %eax, -0x15c(%rbp)
leaq -0x298(%rbp), %rdi
callq 0x6310
leaq -0x299(%rbp), %rdi
callq 0x6550
jmp 0x16631
leaq -0x301(%rbp), %rdi
movq %rdi, -0x3c0(%rbp)
callq 0x6930
movq -0x3c0(%rbp), %rdx
leaq 0x15fa4(%rip), %rsi     # 0x2c3e3
leaq -0x300(%rbp), %rdi
callq 0xa9d0
jmp 0x1644d
movq -0x348(%rbp), %rdi
addq $0x20, %rdi
callq 0x6240
movq %rax, %rdx
leaq -0x2e0(%rbp), %rdi
leaq -0x300(%rbp), %rsi
callq 0x16cc0
jmp 0x16475
leaq -0x2c0(%rbp), %rdi
leaq -0x230(%rbp), %rsi
leaq -0x2e0(%rbp), %rdx
callq 0x1ebb0
jmp 0x16491
leaq -0x2e0(%rbp), %rdi
callq 0x6310
leaq -0x300(%rbp), %rdi
callq 0x6310
leaq -0x301(%rbp), %rdi
callq 0x6550
movq -0x348(%rbp), %rdi
addq $0x8, %rdi
movq %rdi, -0x3d0(%rbp)
callq 0x16dc0
movq %rax, -0x318(%rbp)
leaq -0x310(%rbp), %rdi
leaq -0x318(%rbp), %rsi
callq 0x16df0
leaq -0x2c0(%rbp), %rdi
movq %rdi, -0x3d8(%rbp)
callq 0x6440
movq -0x3d8(%rbp), %rdi
movq %rax, -0x320(%rbp)
callq 0x62f0
movq -0x3d0(%rbp), %rdi
movq %rax, -0x328(%rbp)
movq -0x310(%rbp), %rsi
movq -0x320(%rbp), %rdx
movq -0x328(%rbp), %rcx
callq 0x16d10
movq %rax, -0x3c8(%rbp)
jmp 0x1653d
movq -0x3c8(%rbp), %rax
movq %rax, -0x330(%rbp)
movq -0x18(%rbp), %rdi
callq 0x6850
jmp 0x16556
movq -0x348(%rbp), %rdi
addq $0x8, %rdi
callq 0x16e30
movq -0x348(%rbp), %rdi
movq %rax, 0x60(%rdi)
callq 0x16740
jmp 0x16578
movq -0x348(%rbp), %rdi
callq 0x158a0
jmp 0x16586
leaq -0x2c0(%rbp), %rdi
callq 0x6310
leaq -0x230(%rbp), %rdi
callq 0x16aa0
leaq -0x150(%rbp), %rdi
callq 0x16e50
addq $0x3e0, %rsp            # imm = 0x3E0
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x158(%rbp)
movl %eax, -0x15c(%rbp)
jmp 0x16605
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x158(%rbp)
movl %eax, -0x15c(%rbp)
jmp 0x165f9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x158(%rbp)
movl %eax, -0x15c(%rbp)
leaq -0x2e0(%rbp), %rdi
callq 0x6310
leaq -0x300(%rbp), %rdi
callq 0x6310
leaq -0x301(%rbp), %rdi
callq 0x6550
jmp 0x16631
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x158(%rbp)
movl %eax, -0x15c(%rbp)
leaq -0x2c0(%rbp), %rdi
callq 0x6310
leaq -0x230(%rbp), %rdi
callq 0x16aa0
leaq -0x150(%rbp), %rdi
callq 0x16e50
movq -0x158(%rbp), %rdi
callq 0x6920
nopw %cs:(%rax,%rax)